Joe777
Forum Replies Created
-
Forum: Plugins
In reply to: [WangGuard] Account SuspendedI had the same problem of a bunch of spam registrations once WangGuard quit working. I solved it by taking the advice given here: https://wpbeaches.com/stop-spam-new-user-registrations-on-wordpress/. i.e. I unchecked the ‘anyone can register’ checkbox in General Settings, and I use the Subscribe 2 plugin to manage subscribers. I am a casual user and not aware of all the factors involved, so this may be completely unusable to some, but it works for me.
I’ll chime in: Thanks a lot! It’s great to find a fix posted so quickly.
I tried the suggestion to replace my call to nggShowGalleryTags() with do_shortcode(). Here is the code:
require('../../../../wp-config.php'); $gallery_tag = $_REQUEST['gallery_tag'] ; $page_num = $_REQUEST['nggpage'] ; $pp_gallery = ""; // If there's a page number, set the global variable from the next gen plug in. // It's used in nggShowGalleryTags: if ($page_num !== "") { set_query_var("nggpage",$page_num) ; } // This function is from next gen gallery. It creates all of the html for the // thumbnails to show up: //$pp_gallery = nggShowGalleryTags($gallery_tag) ; $pp_gallery = do_shortcode("[ngg_images tag_ids='$gallery_tag' container_ids='motorrad' display_type='photocrati-nextgen_basic_thumbnails']") ; // Send the results back to the client side: echo $pp_gallery ;
I had to modify Benjamin’s suggested code slightly by replacing source=’tags’ with tag_ids=’tags’, where ‘tags’ is the tag I want for the gallery e.g. tag_ids=’cormorants’.
The results were not very good. Here are the problems:
1. The pagination doesn’t work. The do_shortcode() returns navigation buttons, but they don’t point to a valid page. For example, href=/nggallery/page/2. When I use the shortcode on a post, the navigation points a valid page such as href = /localhost/thelestersnet/2015/tag-gallery-experiment/nggallery/page/2. I tried using my old design where I replace the href so that it calls my php code. This shows the thumbnails, but it doesn’t change the page i.e. it always shows the thumbnails of the first page.
Is there a way I can call do_shortcode() (or some other function) so that it returns the proper page? e.g. In the old NextGEN version I called set_query_var(“nggpage”,$page_num) ;, but this doesn’t work anymore with the new version of NextGEN.
2. The thumbnails were returned and displayed, including the page navigation, but there was no formatting. There was a single long column of photos; the thumbnails have no border; the page navigation is crammed over to the left hand side. The formatting works for posts that use the shortcode, and the formatting was good on the old version of NextGEN Gallery where I called nggShowGalleryTags().
Any idea what I need to do to fix the formatting? e.g. is there a CSS file I am missing that I need to load in my theme? (I don’t know why this would be, since it works for posts, and it worked in the old version of NextGEN).
Thanks again for your help.
Very cool about ‘do_shortcode()’. I should have known ?? I can’t wait to try it, but I anticipate a problem. I assume the ‘do_shortcode()’ will provide the required pagination when needed (e.g. when the number of thumbnails is above a threshold). But how do I make a call to load each page? In my current solution, if the user clicks on a page number, or clicks ‘next’ or ‘prev’, then I call the same PHP, but with updated page numbers (in the PHP I provided you can see that I pass the page number and get it in $page_num, and set it with ‘set_query_var()’). Can I specify in the shortcode which page numbers to show? By the way I’ll add a detail that may be tangential. To make the page navigation work, I wrote javascript code that massaged some of the ‘default’ HTML navigation that was returned from NextGEN with my own HTML that calls the PHP code to load the new gallery without re-loading the entire page.
Also, how do I specify with the shortcode how many thumbnails per page? Or maybe there is a different function call I can use to do this?
Regarding your question about the ‘album template files’, I’m not sure I understand. For my work-a-round, I just copied over gallery.php and modified it, and it worked for all photos, including albums i.e. I left the name as gallery.php. When I was trying the custom template approach, I did the following. I have a theme I wrote called ‘clearcreek’. I copied gallery.php and renamed it to gallery-clearcreek.php, and added my customization to that. Then in the short code, I put template=clearcreek. As I mentioned, I could never get this to work for albums.
Thanks!
Thanks for your response, Benjamin. Unfortunately, unless I misunderstand, it doesn’t address my issues.
For the customization I made to add the photo browser, you suggested using a shortcode. I don’t understand this solution. Is there some way for me to use a shortcode in my PHP code? As I said in my description, and tried to illustrate with the code sample, I need to create the tag gallery dynamically under program control. When the user clicks on a node on the browser tree (created using the jstree library), a javascript function is called. This function then calls a php which runs on the server and returns the html that will be displayed. Following is the javascript code:
jQuery("#tgp2_pictures_div").load(php_string,{"gallery_tag": gallery_tag},tgp2_ProcessThumbGet) ;
‘php_string’ is the URL to the PHP that I showed in my previous post. So this loads the output of the php (the tag gallery in the last ‘echo’ statement in the PHP code I showed) into the HTML element ‘tgp2_pictures_div’.
Since nggShowGalleryTags not longer exists, how can I do this now?
For the custom description text, you said that the custom template works the same as in 1.9. But as I tried to describe in my post, the custom template solution doesn’t work for albums. This is true also for 1.9. I tried many things to make it work for albums, but finally gave up, and went to the solution that I mentioned (i.e. I used gallery.php rather than gallery-custom.php). This work-a-round from 1.9 no longer works in the new NextGEN versions. Can you suggest a solution where I could create custom text based on the photograph’s metadata (note that I must derive new values based on calculations using the photograph’s metadata) that would work on albums as well as ‘regular’ galleries?
Any suggestions are appreciated.
Thanks much for your reply, Benjamin. Sorry I am so long getting back to this. I missed the email that you replied to my post. I’ve never gotten a reply from my other posts for NextGEN support, so I wasn’t expecting one!
There are two customizations that I have done on my website which no longer work with the rewrite of NextGEN gallery. The first is that I created a browser to navigate my photographs. You can see how it works here: https://www.thelesters.net/tag-gallery-page/. I use the javascript library called ‘jstree’. Each node on the tree browser represents a tag in NextGEN gallery. When the user clicks on a node in the tree, I call a php that I wrote, which calls nggShowGalleryTags(). This php loads the gallery associated with the tag without re-loading the entire page. Here is the custom php code:
require('../../../../wp-config.php'); $gallery_tag = $_REQUEST['gallery_tag'] ; $page_num = $_REQUEST['nggpage'] ; $pp_gallery = ""; // If there's a page number, set the global variable from the next gen plug in. // It's used in nggShowGalleryTags: if ($page_num !== "") { set_query_var("nggpage",$page_num) ; } // This function is from next gen gallery. It creates all of the html for the // thumbnails to show up: $pp_gallery = nggShowGalleryTags($gallery_tag) ; // Send the results back to the client side: echo $pp_gallery ;
With the new version of NextGEN gallery, I get an error saying that nggShowGalleryTags() is an undefined function. About a year ago when I first tried to fix this problem I found a function in the new NextGEN called nggShowRelatedGallery() located in nextgen-gallery\products\photocrati_nextgen\modules\ngglegacy\nggfunctions.php. I tried using it and it worked, except that it didn’t do any pagination of the photo thumbnails. For example, with the old version if I select a gallery with more than N thumbnails (e.g. click on ‘Bird Favorites’), then it only sends N, and provides a means to select the next page. I see now that nggShowRelatedGallery() is located in a different location/file (photocrati_nextgen\modules\nextgen_gallery_display\module.nextgen_gallery_display.php), but I haven’t tried using it again yet. I assume there will be no change from the last time.
The second NextGEN customization on my website is that I have a custom caption on the bottom of the photographs. In addition to some information about the photo from the metadata associated with the photo, I display the ‘crop factor’, which is computed by some custom calculations based on the ‘user comment’ metadata that I update in Lightroom.
Here is what I did in the old NextGEN version. I created a child theme (the parent theme is Thematic), which I called clearcreek. I copied gallery.php from nextgen-gallery/view to the new directory in my theme. I then edited gallery.php. There is a loop there that goes through all the images. For each image in the loop I added code to create a string (called $text_display) based on metadata, and calculations from metadata. I then use $text_display instead of $image->description for the photo description.
I tried using the template approach (e.g. [ nggallery id=5 template=<templatename> ]. The problem is that it doesn’t work for albums, and I use albums in my posts. So I resorted to modifying gallery.php in my theme.
On the new version of NextGEN gallery, when I follow the procedure of copying gallery.php and modifying it, it doesn’t work at all. The description on my photos isn’t updated.
I am not an experienced web developer. I read some books, and then learned by doing. I’m likely doing some goofy things. I am familiar with computer programming (a lot of experience in C++).
I’m nervous about sticking with the old version of NextGEN gallery. I thought that if I learned Pope I might be able update my NextGEN version, and do my customizations the ‘right’ way. The only other option is to find a new photograph management plugin (e.g NextCellent or MaxGalleria), but I like NextGEN, and would rather continue with it. I would greatly appreciate any help you can provide.
I have the same issue. I have the latest WP and NG as of today’s date (11/3/2013).
I can get it to work for galleries, but not albums or tag galleries. To work for galleries I do the following:
1. copy gallery.php into the themename/nggallery folder and rename it gallery-themename.php
2. in the shortcode add this template=themename e.g.
[ nggallery id=1 template=themename ]However, this only works for galleries, not albums or tag galleries. Prior to NG2.0 I copied gallery.php to the nggallery folder and modified it, and it worked for everything. After NG2.0, changing gallery.php in nggallery doesn’t effect anything.
Any advice?
Forum: Plugins
In reply to: [Firelight Lightbox] Apply Easy FancyBox to reloaded NextGen Tag GalleryHi Ravan,
That did it! Thanks so much for your help! I didn’t exactly replace tgp2_ProcessThumbGet with easy_fancybox_handler because I need to do some other things besides calling easy_fancybox_handler (e.g. change the navigation between thumbnail pages). Instead, I just put easy_fancybox_handler in the tgp2_ProcessThumbGet, got rid of the klugey php call, and moved the navigation manipulating code into tgp2_ProcessThumbGet.
Thanks for your great plug-in, and for the support.