Hi,
It’s not possible from the plugin directly. But the plugin supports changing the URL via the button shortcode ( see example in plugin, at the top ). You’ll need to use some PHP to change this.
Another option is to make a static redirect to the user profile. I.e. make a redirect like /user-profile.php and inside that file figure out where to redirect the user to ( profile page / login screen ) .
Again this is going to need some PHP knowledge.
Hello again,
I was trying to figure out how I could implement your suggestions and now I have some questions. Maybe you could help me. I designed a button with your plugin and put it in a text-field in the sidebar widget with the shortcode (e.g. [button_2]).
1. I could write in the shortcode for example ‘href=…’ and change the url but it would be still static. Is it possible to use php in the shortcode to get for example the logged-in user to concatenate a dynamic url? (That would be your first suggestion)
2. There are no php-files for the maxbuttons plugin in the normal plugins directories like other wordpress plugins do. Where could I find the php-files I I would like to change them?
3. In the sidebar.php in the theme-directory there is no new entry for my [button_2] where I could customize it’s function with php staticly like you suggested in your second point. Where is this entry done and where could I do this static redirect?
I hope I could describe it propperly. Thank you in advance for your help!
1) You can. But it’s called ‘url’, you can see it in the examples ( the yellow thing on top of the button editor ) : [maxbuttons id=1 url=”] .
2) There are, in the plugins directory. Also I don’t recommend to change anything since it will be overwritten at the next update. Never change plugins for that matter.
3) You have to be inside you theme PHP files. To dynamically change the url you could do this:
<?php $url = 'http://etc';
echo do_shortcode('[maxbutton id=1 url="$url"]'); ?>
Hi,
thank you again for all the answers. I did it the following way:
I inserted following function in my function.php in my theme:
function redirect2account(){
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
if($_SERVER['REQUEST_URI'] == '/redirect_account/' && is_plugin_active('buddypress/bp-loader.php') && is_user_logged_in()){
wp_redirect( '/members/' . bp_core_get_username( bp_loggedin_user_id() ));
exit();
}
}
add_action('init', 'redirect2account');
Then created an empty page with the name redirect_account in http://www.domain.com/redirect_account/ and put this URL in my Maxbuttons url.
It works for me but are there any problems which could happen doing it this way?
Hi,
I think this will work fine. You should just test it a little bit when logged out for instance, or just using a regular user account. Just take all the options you can have, if it works in all cases then you are good to go.