Jump to content
Sign in to follow this  
Jackey

Login WP and Vanilla simultaneously using jsconnect

Recommended Posts

Jackey

I created a button to log in on the branding icons by adding this to functions.php: (it assumes /wp and /forums to be siblings)

add_action('pagelines_branding_icons_end', 'add_icons_to_branding');
	function add_icons_to_branding(){
	?>
	<?php if(!is_user_logged_in()):?>
	  
	<?php endif;?>
	<?php if(is_user_logged_in()):?>
	  
	  
	  <?php global $current_user;
	    get_currentuserinfo();
	    echo "Profiel: " . $current_user->display_name . " ?»";?>
	  <?php endif;?>
	<?php }[/code]

	
	But it has one snag... you always end up in the forum after logging in.
	
	Somehow,
	
[code]&Target=<?php echo $_SERVER['REQUEST_URI'];

does not get processed. Maybe someone else can help here? My objective is to elegantly return to the page where the login is made. Also... any tips on how to extract the client_id with a short code from WordPress are welcome. I'm not a PHP guru, but don't mind to break a few things before getting results. ;)

Share this post


Link to post
Share on other sites
Jackey
Changed the code to this: [code] display_name . " ?»";?> [/code] But still the: [code]&Target=

Share this post


Link to post
Share on other sites
Danny
Hi Jackey, Thanks for posting, I am a PHP nub so I can't help you but I'm sure there are some users on here who should be able to assist you.

Please search our forums, before posting!

Share this post


Link to post
Share on other sites
Simon
http://codex.wordpress.org/Function_Reference/get_permalink Are you in the loop? Could try adding: [code]global $post;[/code] Then use.. [code]get_permalink( $post->ID )[/code] In the couple of places you have it.

Share this post


Link to post
Share on other sites
Jackey
Hi Simon, Added it, but allas, it still does not return to the page it is called from. Strange, because this is the URL it generates [code]"http://golfclub-stippelberg.nl/wp/wp-login.php?redirect_to=http://golfclub-stippelberg.nl/wp/../forums/entry/jsconnect?client_id=14478729&Target=http://golfclub-stippelberg.nl/2012/01/enkele-belangrijke-mededelingen-voor-het-nieuwe-jaar/"[/code] It is as if the Target is stripped by the vanilla jsconnect plugin.

Share this post


Link to post
Share on other sites
Simon
how is it getting a /../ in the url?

Share this post


Link to post
Share on other sites
Jackey
Hardcoded... [code]echo get_site_url()?>/../forums/entry/jsconnect?....[/code] I know, it's crude. Is there a get_home_url() ?

Share this post


Link to post
Share on other sites
Simon
just home_url() it isnt echoed http://codex.wordpress.org/Function_Reference/home_url

Share this post


Link to post
Share on other sites
Simon
[code]echo sprintf( '%s/forums/entry/jsconnect?client_id=14478729', home_url() )[/code]

Share this post


Link to post
Share on other sites
Jackey
Quite a bit more elegant. Thanks!

Share this post


Link to post
Share on other sites
Jackey
I don't think I will get that - redirect after log into Vanilla - to work. I guess I'm out of my depth, so I better hit the books. This solution will do for now.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×