Beee
Forum Replies Created
-
@kalum76 I am not quite sure what you mean.
The question at hand is: how can I reload the page when clicked on a tab link, instead of switching it with ajax ?
Thanks for your answer, but as you can read in my follow up posts, I tried that but didn’t work. The ajax action still ‘took’ over.
I don’t think this is easily done (if at all possible).
I answered your question in another topic where you also asked it.
I think you’re looking for the filter
um_after_user_account_updated
which you can find here.Below is my example which is working for me. I only started using it yesterday so can’t tell if this is the best way.
First add a new tab:
/** * Add account tabs * * @param $tabs * * @return mixed */ function beee_custom_account_tabs( $tabs ) { $tabs[ 250 ][ 'settings' ][ 'icon' ] = 'um-faicon-wrench'; $tabs[ 250 ][ 'settings' ][ 'title' ] = __( 'Settings', 'beee' ); $tabs[ 250 ][ 'settings' ][ 'custom' ] = true; $tabs[ 250 ][ 'settings' ][ 'show_button' ] = true; $tabs[ 250 ][ 'settings' ][ 'submit_title' ] = __( 'SAVE', 'beee' ); return $tabs; } add_filter( 'um_account_page_default_tabs_hook', 'beee_custom_account_tabs', 100 );
Then call the tab content:
/** * Call output tab settings * * @param $info */ function beee_account_tab_settings( $info ) { global $ultimatemember; extract( $info ); // this one is probably redundant $output = $ultimatemember->account->get_tab_output( 'settings' ); if ( $output ) { echo $output; } } add_action( 'um_account_tab__settings', 'beee_account_tab_settings' );
Output the tab content:
/** * Output tab settings * * @param $output * * @return string */ function beee_account_content_hook_settings( $output ) { ob_start(); ?> <div class="um-field"> <p> <?php _e( 'Here you can find some general settings.', 'beee' ); ?> </p> <p> <label for="um_account_instagram">Your Instagram name</label> <input type="text" name="um_account_instagram" id="um_account_instagram" class="" value="" placeholder="@yourname"/> </p> <p> <label for="um_account_twitter">Your Twitter name</label> <input type="text" name="um_account_twitter" id="um_account_twitter" class="" value="" placeholder="@yourname"/> </p> <p> <label for="um_account_lanuage">Default language</label> <br/> <select id="um_account_lanuage" name="um_account_lanuage"> <option value="en"><?php _e( 'English', 'beee' ); ?> <option value="nl"><?php _e( 'Dutch', 'beee' ); ?> <option value="de"><?php _e( 'German', 'beee' ); ?> </select> </p> </div> <?php $output .= ob_get_contents(); ob_end_clean(); return $output; } add_filter( 'um_account_content_hook_settings', 'beee_account_content_hook_settings' );
Then after the account is saved, you can access the $_POST data and do whatever you need to do with the data.
/** * Do stuff after "Update Account" * * @param $user_id * @param $changes */ function beee_after_user_account_updated( $user_id, $changes ) { if ( ! empty( $_POST[ 'um_account_instagram' ] ) ) { update_user_meta( $user_id, 'um_account_instagram', $_POST[ 'um_account_instagram' ] ); } } add_action( 'um_after_user_account_updated', 'beee_after_user_account_updated', 10, 2 );
Hope this helps…
- This reply was modified 6 years, 1 month ago by Beee. Reason: fix link
/** * Redirect user after login * * @param $args */ function sd_redirect_user_login( $args ) { wp_safe_redirect( {your url} ); exit; } add_action( 'um_on_login_before_redirect', 'sd_redirect_user_login', 10, 1 );
Please also build in an option to select an image size for the cover photo. Now it’s loaded at full size.
Then I think you might have added the new tab incorrectly.
I was able to add a new tab, following the plugin’s documentation and select it as default.
This is the code I use to add 2 tabs. I have only added how to fill the content of 1 tab because the 2nd one is identical.
/** * Add custom profile tabs * * @param $tabs * * @return mixed */ function fr_add_custom_profile_tabs( $tabs ) { $tabs[ 'registrations' ] = array( 'name' => 'Registrations', 'icon' => 'um-faicon-list-ul', ); $tabs[ 'bookmarks' ] = array( 'name' => 'Bookmarks', 'icon' => 'um-faicon-bookmark', ); return $tabs; } add_filter( 'um_profile_tabs', 'fr_add_custom_profile_tabs', 1000 ); /** * Content for custom tab 'registrations' * * @param $args */ function fr_profile_content_registrations( $args ) { echo "<p>This will show the user's registrations.</p>"; } add_action( 'um_profile_content_registrations', 'fr_profile_content_registrations' );
After saving it and loading the page, I was able to select any page as default.
See screenshot: https://imgur.com/a/IHmzfChI think it can be done with some custom code…
I just noticed this doesn’t work, only from ‘within’ the tab content.
So the question is now, how can I reload the page when clicked on a tab link, instead of switching it with ajax ?
I have to clarify a bit. I know I can edit the account.php template but I’m looking for a hook/filter/action.
Forum: Plugins
In reply to: [Disable REST API] Plugin not working ?Thank you…. stupid I didn’t think of this ??
Forum: Plugins
In reply to: [Theme My Login] Passwords fields show (when not supposed to)I moved the shortcode to the page which was created upon activation. That did the trick…. Took me a bit before i realised what caused it and how to solve it, basically what you explained.
Might be helpful to make a note of it in the docs. If it’s in there, I overlooked it.
Forum: Plugins
In reply to: [Theme My Login] Passwords fields show (when not supposed to)It just hit me. I suspect this is connected to the post meta which is set upon launch ? Because when I use the page that was ‘set’ upon activation it does work.
Forum: Plugins
In reply to: [Theme My Login] Passwords fields show (when not supposed to)I tried adding it as shortcode in the content and also ‘hardcoded’ in the template itself. Both show the same.