• Resolved HawksDev

    (@kc9ryt)


    Hello,

    I am trying to add a tab to the my account page and have the content be a shortcode to another plugin. I can get the tab to show the plugin content but the shortcode has a submit button as part of its functions and when that is clicked it says it updated the users profile but the button is not actually submitting the user inputted data to the plugin itself. Rather it seems it is submitting the data to ultimate member. How can I make it so the shortcode just interfaces with it self and doesn’t send data to ultimate member for it to interpret?

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @kc9ryt

    Unfortunately, you can only hide that button with CSS.

    #um_account_submit_mycustomtabname{ display: none; }

    Just change the mycustomtabname with the custom tab key/name.

    Regards,

    • This reply was modified 4 years, 5 months ago by Champ Camba.
    Thread Starter HawksDev

    (@kc9ryt)

    Hello @champsupertramp

    Thanks for that. In regards to the data submitting to the plugin and not being intercepted by ultimate member do you know how I could change this? I was able to add a custom tab to the profile page with my shortcode and it works but adding it to the account page doesn’t actually submit any changes to the plugins functions. Here are a few screen shots to help show what I am talking about:

    My custom tab showing the shortcode:
    https://ibb.co/K0PmqPN

    After I click submit:
    https://ibb.co/x25Fh9B

    Expected result that I am needing that works on the profile page:
    https://ibb.co/PC7NCyb

    Here is my code:

    /* add new tab called "mytab" */
    
    add_filter('um_account_page_default_tabs_hook', 'my_custom_tab_in_um', 100 );
    function my_custom_tab_in_um( $tabs ) {
    	$tabs[800]['mytab']['icon'] = 'um-faicon-pencil';
    	$tabs[800]['mytab']['title'] = 'My Custom Tab';
    	$tabs[800]['mytab']['custom'] = true;
    	return $tabs;
    }
    	
    /* make our new tab hookable */
    
    add_action('um_account_tab__mytab', 'um_account_tab__mytab');
    function um_account_tab__mytab( $info ) {
    	global $ultimatemember;
    	extract( $info );
    
    	$output = $ultimatemember->account->get_tab_output('mytab');
    	if ( $output ) { echo $output; }
    }
    
    /* Finally we add some content in the tab */
    
    add_filter('um_account_content_hook_mytab', 'um_account_content_hook_mytab');
    function um_account_content_hook_mytab( $output ){
    	ob_start();
    	?>
    		
    	<div class="um-field">
    		
    		<?php echo do_shortcode('[office365distributiongroups]'); ?>
    		
    	</div>		
    		
    	<?php
    		
    	$output .= ob_get_contents();
    	ob_end_clean();
    	return $output;
    }
    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @kc9ryt

    Try adding this to the shortcode, in the form of the distributions group fields.

    $user_id = get_current_user_id();
    echo "<input type='hidden' name='profile_nonce' id='profile_nonce' value='".esc_attr( wp_create_nonce( 'um-profile-nonce' . $user_id ) )."' />";

    Regards,

    Thread Starter HawksDev

    (@kc9ryt)

    Hey @champsupertramp

    Sadly that did not work. When i hit the submit button to update the groups the account page after it loaded still took the data as if i wanted ultimate member to handle it and not the plugin itself.

    Thread Starter HawksDev

    (@kc9ryt)

    Hey @champsupertramp

    After digging in a little more i noticed that the entire menu on the account page is a form which means i am trying to put a form inside of another form. Do you know if there is a way to change this?

    Thread Starter HawksDev

    (@kc9ryt)

    Hey @champsupertramp

    I was able to finally get this working. What I had to do was in my original code before <?php echo do_shortcode('[office365distributiongroups]'); ?> I added </form> to close out the main form so that my plug-in could render its own. Thanks for the help.

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @kc9ryt

    Thanks for letting us know how you resolved the issue.

    Regards,

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Create Custom Account Tab with Shortcode’ is closed to new replies.