• Hi,

    i′m using custom profile tabs with

    add_filter('um_user_profile_tabs', 'custom_tab' );
    function custom_tab($tabs) {
    	//Add tab
    	$tabs['test_tab'] = array(
    		'name' => 'Test Tab',
    		'icon' => 'um-faicon-users',
    		'count' => 0
    	);
    	return $tabs;
    }
    
    add_filter('um_profile_content_test_tab', 'custom_tab_content' );
    function custom_tab_content($args) {
    	echo 'Custom Tab Content';
    }

    Now I want insert different profile forms in different tabs. How to insert [ultimatemember form_id=xx] in this code?

Viewing 15 replies - 1 through 15 (of 16 total)
  • You are supposed to enter the content inside ‘Custom Tab Content’.

    echo 'Custom Tab Content';

    You can not enter a shortcode

    • This reply was modified 8 years, 4 months ago by borisv.
    Thread Starter befla.net

    (@beflanet)

    yes I know that I can′t enter the shortcode there. Because of that I need to know how to change the shortcode to php.

    Thread Starter befla.net

    (@beflanet)

    I tried with

    function um_profile_content_1_default( $args ) {
    	global $ultimatemember;
    	echo do_shortcode( '[ultimatemember form_id=81]' );

    but on click it takes me to the homepage

    Try this code instead:

    add_filter('um_user_profile_tabs', 'custom_tab' );
    function custom_tab($tabs) {
    	//Add tab
    	$tabs['test_tab'] = array(
    		'name' => 'Test Tab',
    		'icon' => 'um-faicon-users',
    		'count' => 0
    	);
    	return $tabs;
    }
    
    add_filter('um_profile_content_test_tab', 'custom_tab_content' );
    function custom_tab_content($args) {
    	echo do_shortcode('[ultimatemember form_id=81]');
    }
    Thread Starter befla.net

    (@beflanet)

    This I tried before and also takes me to my homepage

    Thread Starter befla.net

    (@beflanet)

    the code I have in my functions.php of the template

    You mean the code is at the functions.php of your style theme. Did you paste it at the very end? Maybe you didn’t paste it correctly. As I said, the code works on my site (I suppose you checked it out using the link I gave you), so that’s not a UM issue.

    Thread Starter befla.net

    (@beflanet)

    yes, I have it totally at the end.
    Now I realized that the code doesn′t work with profile form, just with login and register forms.

    • This reply was modified 8 years, 4 months ago by befla.net.

    You can not put a profile page inside a custom profile tab, because a profile page is also short-coded so you’d be creating sort of like an endless loop. Even if you could the idea is silly.

    No. That’s not the same thing. But the idea to have your entire default profile form in a new profile tab is. You’d be only duplicating it. You can not use the same profile shortcode. You can try creating a new form and adding a few custom fields. Then with that new shortcode you can paste it using the code above. That is the correct way of using it.

    • This reply was modified 8 years, 4 months ago by borisv.
    Thread Starter befla.net

    (@beflanet)

    That′s I′m trying to do. I have some new profile forms with custom fields like “number of contract”, “date of invoice”, etc. Of course the default profile form I don′t need in a custom tab because its in the “about” tab.

    Again, you can not use a profile form shortcode. You need to ask a developer for help.

    Thread Starter befla.net

    (@beflanet)

    It works like I wanted without need to ask a developer. For it works you need to set the option to “Yes” for “Can view other member profiles?” at Ultimate Member > User Roles > Members ( Edit ) > Profile Access > Can view other member profiles.

    What does the “User Roles” have anything to do with it? You are an Admim so it makes no difference. You want to add a profile form shortcode to the code above and that is simply not possible, even with your solution.

    Good luck.

    Thread Starter befla.net

    (@beflanet)

    I don′t know what the user role have to do with. I just know that now works my profile form with my code.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘How to add form in template’ is closed to new replies.