"Grassroot Interests" as the name suggests get you the common interest out of specific keyword. The purpose of this module is to enhance user experience while search (Apache Solr or Drupal Default Search). This is not search dependent but it focuses on the "search keywords" added to search.
Using this module we can add multiple associated keywords to any term, node, group, view, panel...etc. anything that has a destination URL. And associate a title to it.
This module provides a interface to add keywords to the pointing towards a particular specialty they belong to. Whenever a keyword is hit in search term it provides a link to that specialty the keyword belong to.
Sandbox link :
http://drupal.org/sandbox/ravy/1554518
GIT Clone :
git clone --recursive --branch 7.x-1.x http://git.drupal.org/sandbox/ravy/1554518.git grassroot_interests
| Comment | File | Size | Author |
|---|---|---|---|
| #21 | panels pages GI-search.png | 96.7 KB | ravyg |
| #21 | add search plugin #2.png | 63.15 KB | ravyg |
| #21 | GI search save plugin pane #3.png | 59 KB | ravyg |
| #21 | page save GI #4.png | 64.25 KB | ravyg |
| #21 | GI results #5.png | 54.83 KB | ravyg |
Comments
Comment #1
a_thakur commentedHi,
Some manual review of the code.
README.txt
Please make the README.txt in a proper format. Read here for more details. sun's README.txt style is really cool, I follow that.
grassroots_interests.info file
description should end with a full stop.
grassroots_interests.module file.
Line #16 to #21. Since the implementation of hook_help() is empty. Either remove it or implement the functionality.
Line #15
Use module_load_include() instead. So the corresponding code would be
In the implementation of hook_permission() adding description to the permissions would be good as it clarifies what actually the permission is meant for.
Line #45
Avoid underscores in menus, instead use "-". So the corresponding function would be
grassroot_interests.install file
But in your code the implementation is incorrect.
Please make the changes accordingly. Please make the changes as described especially the implementation of hook_install() and it is highly recommend to get a review bonus so we can come back to your application sooner.
Comment #2
a_thakur commentedChanging the status to needs work and would be great if you follow the review bonus stuff mentioned above.
Comment #3
ravyg commentedThanx will fix all those.
Comment #4
ravyg commented1) Added
- Configurable text to be shown in plugin.
- Configure number of results to be shown.
2) Code clean up done!
3) all changes mentioned in #1
Comment #5
swim commentedHi,
First off; useful idea with clean execution into a drupal module, it works as expected with very few bugs. On the automated side of things,
This looks like a false positive as your setting the variable; not a user.
Small fix required.
Manual notices;
Cheers,
Comment #6
ravyg commentedHi Mr Asia,
First of all Thanks a lot for such a wonderful review. It is a great help.
1) "Line 163: Potential problem: FAPI elements '#title' and '#description' only accept filtered text, be sure to use check_plain(), filter_xss() or similar to ensure your $variable is fully sanitized."
Here title is a static title as "Add Keywords" which appears as a fieldset title, I have added a simple check_plain().
2) "Line 291: The $message argument to drupal_set_message() should be enclosed within t() so that it is translatable." nice observation added a t() to it.
Manual notices :
1) I have already changes all admin/grassroot_interests to admin/grassroot-interests I think I did commit it after you took clone. Can you please let me know if the problem was link appearing as "admin/grassroot_interests" or some other.
2) Added some checks for preexisting keywords. added functionality so if even a user enters a keyword 2-3 times it will get replace into 1 unique keyword.
Link to ventral review for code cleanup status.
http://ventral.org/pareview/httpgitdrupalorgsandboxravy1554518git-7x-1x
Please review and promote for full project.
Comment #7
marshmn commentedHi,
A few points from a manual review:
1) In grassroot_interests.module: in grassroot_interests_add_keywords_form() you set $title to a string literal (line 137) and then conditionally overwrite it with another literal (line 139) - I believe that both of these literals should be translatable ie. should be wrapped with t().
2) When the above $title is used (line 163) it is put through check_plain() - but I don't think this is needed since the only way that $title gets set is from a literal as far as I can see?
3) In grassroot_interests.info you have the line for specifying the core version twice for some reason?
4) As per the automated review, there is still a master branch which should be removed (see http://drupal.org/node/1127732).
Comment #8
ravyg commentedHi Matt Marsh,
Thank for the review
I think all the points you have mentioned are valid and I have made the changes accordingly :
1) t() added.
2) check_plain() removed.
As per the review post in #5 1) added check_plain() to title and description,
But for $title, I added the same comment in #6 2) as of yours in #7 1) hence I think check_plain() can be removed from title as per the discussion in #6 .2) and #7 .1).
As the field-set title appearing in admin interface need not to be customized. The title remains static.
Currently I am adding a comment in code to add check_plain() if needs to be made customizable in future if a feature request appears. - please correct me if I am wrong.
3) core version removed.
4) master branch removed.
Link to ventral review for code cleanup status.
http://ventral.org/pareview/httpgitdrupalorgsandboxravy1554518git-7x-1x
Sandbox link :
http://drupal.org/sandbox/ravy/1554518
GIT Clone :
git clone --recursive --branch 7.x-1.x http://git.drupal.org/sandbox/ravy/1554518.git grassroot_interests
Once again thanks for reviews they are really very very helpful.
Please review and promote for full project.
Comment #9
a_thakur commentedWould be great in case you could review other projects and get a review bonus.
Comment #10
ravyg commentedYup Ashish I will surely do that.
Comment #11
serjas commentedHi,
# there is no hook_install , you need this to install schema
Comment #12
patrickd commentedthere is no need to install or uninstall schemas in drupal 7, this happens automatically
Comment #13
ravyg commentedThanks Serjas for raising that issue, I was also not completely sure on it :) and Patrickd for the explanation.
Comment #14
serjas commentedHi,
some suggestions
# add dependency for specific 'Page manager' in .info than panel
# in project details under requirement , specify optional modules like drupal search (i didnt enabled drupal's default search), solr etc
tested the module , followed instruction and create a keyword and a panel page, when viewing panel page got "Notice: Undefined offset: 0 in grassroot_interests_content_type_render() (line 29 of D:\wamp\www\drupal-7.4\sites\all\modules\contributed\grassroot_interests\plugins\content_types\search_interest.inc)."
Comment #15
ravyg commentedHi Serjas,
Once again thank for review :)
1) page_manager added to dependencies.
2) Can you please elaborate when you are getting that warning?
I am not able to reproduce it.
I have still added a condition as :
$keyword = '';
if(isset($args[0])){
$keyword = strip_tags($args[0]);
}
this checks for the $args[0] is keyword is set or not if not it sends a empty keyword string.
hope this will get rid of that error for you can you please check and let me know.
Can you add some php error logs or screenshot if possible it will be a great help.
Thank in advance
Comment #16
ravyg commentedComment #17
serjas commentedHi,
now error is gone . probably i didnt added keywords . but i am not getting anything on my test panel page! (sorry i didnt get the idea how this module works). do you have any demo page?
Comment #18
ravyg commentedPlease have a look at README.txt
And configuration steps at :
http://drupal.org/sandbox/ravy/1554518.
Thanks.
Comment #19
serjas commentedalready followed instruction check my comment
created panel page, added search, but nothing displayed on that page
Comment #20
ravyg commentedSetting up Panel page (adding plugin)
- Move to : Structure >> Pages.
- Create or enable the page you want to add GI results.
- Move to contents tab.
- Add Content > select Search Interest > GI - Your Interests.
- Configure value on "Number of results to diaplay on match".
- Set the text to be shown.
- Hit Finish.
- Save and update the panel page.
- Done!
I think you need to add pane "GI - Your Interests"
please have a look at screenshots added below.
Hope they are helpful.
:)
Comment #21
ravyg commentedSetting up Panel page (adding plugin)
- Move to : Structure >> Pages.
- Create or enable the page you want to add GI results.
- Move to contents tab.
- Add Content > select Search Interest > GI - Your Interests.
- Configure value on "Number of results to diaplay on match".
- Set the text to be shown.
- Hit Finish.
- Save and update the panel page.
- Done!
I think you need to add pane "GI - Your Interests"
please have a look at screenshots added below.
Hope they are helpful.
:)
Screenshot links:





Comment #22
serjas commentedi think you misunderstood , i have followed exactly same way.. i just wondering how display page will look like.. i am getting a blank page!
Comment #23
opensense commentedHi Srejas,
Adding screenshots to your comments maybe helpful.
Thanks for your time reviewing.
Comment #24
ravyg commentedHi Serjas,
Can you also attach you php error logs.
Thanks
Comment #25
ravyg commentedHi Serjas,
I again tested the functionality with fresh drupal installation.
Its works for my no error.
Steps updated in Screenshots at :
http://drupal.org/sandbox/ravy/1554518
please have a look once.
Waiting for other reviews.
Thanks in advance
Comment #26
serjas commentedhi now its working fine.. you know what made me confused? this line
# actually you cant create a page , you have to enable 'search-node' and 'search-user' panel
# then you have to add a variant in this panels
# then add GI search to panel region
now perform a search, its displayed in search page :)
Comment #27
serjas commentedComment #28
piyuesh23 commentedWorks fine for me.
Comment #29
ravyg commentedIt works on custom page as well
You just need to set your search from redirection to that page.
and add !keywords to you page URL
For eg :
If u have a page like :
sitename.local/gi-search-test/!keywords
This can be done and it will start to works
CheerS
Comment #30
ravyg commented#29
Comment #31
opensense commentedAll looks good, and really a useful module. Cheers! Should be promoted.
Comment #32
abhishek.kumar commentedIt's works for me should be promoted as full project.
Comment #33
patrickd commentedComment #34
patrickd commentedWow, I like screenshots too! :)
; Information added by ravyg started writing script on 9th april 2012You don't have to add such a line, this is only for packaging purposes, and GIT already takes care about logging who has done what and when.
don't use module_load_include() in global spec, only use it within functions and it's also only necessary for including files of foreign modules. Use require_once for files you always include and include_once for conditional inclusions.
Please indent method calls, like db_selects:
I think you missunderstood the hook-thing.
There's a hook_form() but there's no hook_form_submit().
Use the "Implements ..." documentation text ONLY for hooks. What you use it for are Form and Submission Callbacks! not hooks.
If you define function Callbacks - make sure there's no hook that you collide with!
Whenever possible do not use arg() function, make use of the "page arguments" functionality of hook_menu() so you can get your needed information directly as function parameter -> please re-read hook_menu documentation.
$items['admin/help/grassroot-interests']There's no reason to create this menu item, the help module will take care of this.
Implements hook_perm().It's called hook_permission(), so document it properly.
grassroot_interests_settings_form()There are no settings, just more documentation and a redirecting submit button -> let help module take care of giving help.
check_plain(filter_xss($post_data['name'][1]['first'])),Sorry, this code makes no sense and gives me the feeling that you hardly have an idea how and when to filter strings for security.
Please read Writing secure code documentation
$newline = "\n";What about PHP_EOL?
variable_del('grassroot_interests_string');Do you even use this variable?
Please initialize arrays before using them to prevent having notice's all over my watchdog logs.
Never ever use t() in global space - except you want to kill the overall site's performance by 50%.
Sorry, the module may work good, but it's code needs some cleanup. Also I'd like to be sure you understood the correct usage of filter functions as security is the most major thing in this process. Also you need to understand the difference between hooks and callbacks.
Comment #35
ravyg commented@patrickd
Hi,
Need some help.
I am not getting the last points :
"Never ever use t() in global space - except you want to kill the overall site's performance by 50%"
- Can you please give me an example?
- Are you talking about using t() in form elements ?
Comment #36
ravyg commentedComment #37
ravyg commentedPlease review!
Comment #38
sharique commentedlooks good.
Comment #39
opensense commentedComment #40
chx commentedThanks for your contribution, rayg!
I updated your account to let you promote this to a full project and also create new projects as either a sandbox or a "full" project.
Here are some recommended readings to help with excellent maintainership:
You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and get involved!
Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
Thanks to the dedicated reviewer(s) as well.
Comment #42
avpaderno