WPPA and PHP Expert Help
-
The Start
I wanted to have a page where members could upload their photos and see only the photos they uploaded.
So, I created a shortcode inserted into my child themes functions.php file
Parts between ** removed for securityfunction current_user_gallery_sc() { if ( is_user_logged_in() ) { global $wpdb; global $current_user; get_currentuserinfo(); $ifuser = $current_user->user_login; $albumid = $wpdb->get_var("SELECT id FROM *NAME OF DB* WHERE owner = \"$ifuser\""); echo wppa_albums($albumid); //For debugging, making sure variables are getting correct values echo $albumid; echo $ifuser; } } add_shortcode('current_user_gallery', 'current_user_gallery_sc');
it worked!
I broke it
The auto generated name setting in the plugin was set to ID and I wanted it set to Display Name. So I changed it in the settings and then. I made the mistake of deleting the DB entries for the albums
It hasn’t worked since.What I have done to try and fix it
I de-activated the plugin then deleted the plugin and then made sure all DB entries where gone as well as any remaining files in the the directories.
Then re-installed the plugin. Didn’t work.Did the ultimate fix, I thought
I wiped my entire wordpress installation deleted the whole DB everything.
Started from scratch.The wppa plugin has a debug feature and this is what it shows
[WPPA+ dbg msg: Entering wppa_albums] [WPPA+ dbg msg: Lang=en, Locale=en_US, Ajax=] [WPPA+ dbg msg: $wppa_session = a:6:{s:4:"page";i:13;s:4:"ajax";s:1:"0";s:2:"id";s:2:"10";s:11:"search_root";s:1:"2";s:7:"rootbox";s:1:"0";s:16:"use_searchstring";s:0:"";}] [WPPA+ dbg msg: Usr_upl entered] [WPPA+ dbg msg: Potential search root = 2] [WPPA+ dbg msg: Plugin load time :0.065s.] [WPPA+ dbg msg: Init runtime time :0.001s.] [WPPA+ dbg msg: Num queries before wppa :47] [WPPA+ dbg msg: alb=2, albenum=] [WPPA+ dbg msg: alb=2, albenum=, l_a=, l_a_p=0] [WPPA+ dbg msg: pid=6, type=page, alb=2, sep=, slide=, t_c=0, ph=0] [WPPA+ dbg msg: get_albums entered: 1 Start_album=2, Cover=0] [WPPA+ dbg msg: get_thumbs entered: 1 Start_album=2, Cover=0] [WPPA+ dbg msg: Get thumbs took 0.00046896934509277 seconds, found: 1 items.] [WPPA+ dbg msg: Time elapsed occ 1:0.008s. Tot:0.008s.] [WPPA+ dbg msg: Number of queries occ 1:8] [WPPA+ dbg msg: Cumulative query stats: Q=query, G=cache Q-A=>1, Q-PH2=>1, Q-bc1=>1, Q-bc2=>1, Q-bc4=>1, Q-meta2=>1, Q11b=>1, Q201=>1, Q59=>1, G-A1=>3, Total queries attempted: 12, Cash hits: 3, equals 25.00%, misses: 9. 2nd level cache entries: albums: 1, photos: 1 NQ=55]
The album id is 2 and has one phot uploaded to it with the id of 1
- The topic ‘WPPA and PHP Expert Help’ is closed to new replies.