39 reputation
4
bio website basement-garden.co.uk
location
age
visits member for 2 years, 2 months
seen Mar 7 '13 at 11:31

Mar
5
comment How can I call a specific file (via php) by referencing the logged-in username?
Never mind, sorted. For those interested, here's how: <?php global $current_user;?> <?php if(is_user_logged_in()) :?> <?php get_currentuserinfo();?> <?php if(is_array( $current_user->roles ) && in_array( 'map_user', $current_user->roles ) ) : ?> <?php $main_folder = $_SERVER['DOCUMENT_ROOT']; ?> <div id="mapContent"> <?php require($main_folder."/mapping/".$current_user->user_login.".html"); ?> </div> <?php endif; ?> <?php endif; ?>
Mar
5
awarded  Commentator
Mar
5
comment How can I call a specific file (via php) by referencing the logged-in username?
Quick note - the above works fine on my localhost version, but when uploading to the live site the requires breaks. This is presumably because of misdirected links (I get a 'file not found' error). Any chance of showing how to integrate the DOCUMENT_ROOT code into the snippet you've given Sephiroth?
Mar
5
accepted How can I call a specific file (via php) by referencing the logged-in username?
Mar
5
comment How can I call a specific file (via php) by referencing the logged-in username?
Great stuff, this works fine (I had to remove the final "/" from the 'require' line though). Folder location isn't an issue, I can work that out now the principle's in place - thanks all.
Mar
4
comment How can I call a specific file (via php) by referencing the logged-in username?
Hi @MikeMadern - thanks for the pointer. The code doesn't appear to work on my localhost tester. No errors are given. For testing I replaced the 'requires' section above with a simple paragraph (<p>test</p>) - but this simply doesn't appear when the page is loaded by my test account (which has the appropriate user role), so it's as if the code has been excised or ignored.
Mar
4
asked How can I call a specific file (via php) by referencing the logged-in username?
Feb
13
awarded  Supporter
Feb
13
accepted Is it possible to incorporate username in a login redirect?
Feb
13
comment Is it possible to incorporate username in a login redirect?
Ha! Okay, okay, you got me! Thanks for the assist :)
Feb
13
comment Is it possible to incorporate username in a login redirect?
Hi @s_ha_dum - thanks for the suggestion. Trying this resulted in the login being forwarded to '[home]/mapping/user-data-user_login/' rather than the user name itself. Any thoughts?
Feb
13
asked Is it possible to incorporate username in a login redirect?
Apr
4
accepted Is it possible to integrate Wordpress *posts* and social media (Facebook, Google+, Twitter)?
Apr
4
comment Is it possible to integrate Wordpress *posts* and social media (Facebook, Google+, Twitter)?
I hadn't counted on the need for FB account verification before being able to set up integration. I'm uncertain as to whether I trust FB enough to do this, but I think the plugins above would have been/will be the ones I go for if and when this happens.
Apr
3
comment Is it possible to integrate Wordpress *posts* and social media (Facebook, Google+, Twitter)?
Cheers very much for that - Facebook was really the central one I was after, so this should more than fit the bill.
Apr
3
asked Is it possible to integrate Wordpress *posts* and social media (Facebook, Google+, Twitter)?
Feb
17
awarded  Scholar
Feb
17
accepted Assign title-specific class to list items in menu based on WP pages
Feb
17
comment Assign title-specific class to list items in menu based on WP pages
Perfect - thanks for that Tom. I just had to change the function from wp_page_menu to wp_nav_menu and I was away.
Feb
17
awarded  Student