Title: Hardcode [join-this-site] button/functionality
Last modified: August 22, 2016

---

# Hardcode [join-this-site] button/functionality

 *  Resolved [antoniorigo](https://wordpress.org/support/users/antoniorigo/)
 * (@antoniorigo)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/hardcode-join-this-site-buttonfunctionality/)
 * I’d like to be able to hardcode that button in my theme.
 * What would be the appropiate way to do that?
 * thanks, and kudos for the awesome plugin!
 * [https://wordpress.org/plugins/join-my-multisite/](https://wordpress.org/plugins/join-my-multisite/)

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

 *  Plugin Author [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [11 years, 3 months ago](https://wordpress.org/support/topic/hardcode-join-this-site-buttonfunctionality/#post-5633051)
 * Given than the plugin has some components that can be edited and adjusted per
   site (by intent) this may not work out well.
 * But. You can use do_shortcode() to echo shortcodes in templates: [http://codex.wordpress.org/Function_Reference/do_shortcode](http://codex.wordpress.org/Function_Reference/do_shortcode)
 *  Thread Starter [antoniorigo](https://wordpress.org/support/users/antoniorigo/)
 * (@antoniorigo)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/hardcode-join-this-site-buttonfunctionality/#post-5633054)
 * Thanks Mika for this awesome plugin. Very useful functionality!
 * Didn’t know about that function, it will come handy, i’m sure.
 * The thing is I’d like to expand your button/shortcode functionality, I want to
   make a single button that does:
 * 1) If visitor is not registered on the multisite, button shows “Subscribe” text.
   on click, show modal so the visitor can sign up with facebook, then automatically
   sign in and add as suscriber of current site. Button text changes to “Subscribed”.
 * 2) If the visitor is registered on the multisite, but not registered to the current
   site, button shows “Subscribe” text. on click, user is added as subscriber of
   the current site. Button text changes to “Subscribed”.
 * I have the first use case working as described.
 * Now I’m trying to get the second use case going, and I might need to tweak your
   code so it would work as i need it to.
 * So far i’ve tried using the form the shortcode outputs with no success:
 *     ```
       <form action="?jmm-join-site" method="post" id="notmember">
       	<input name="action" value="jmm-join-site" type="hidden">
       	<input value="Join This Site" name="join-site" id="join-site" class="button" type="submit">
       </form>
       ```
   
 * Am I missing something?
 * Thanks again,
    A
 *  Plugin Author [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [11 years, 3 months ago](https://wordpress.org/support/topic/hardcode-join-this-site-buttonfunctionality/#post-5633057)
 * `<form action="?jmm-join-site"` only works because the plugin’s running.
 * [https://plugins.trac.wordpress.org/browser/join-my-multisite/trunk/lib/shortcode.php#L63](https://plugins.trac.wordpress.org/browser/join-my-multisite/trunk/lib/shortcode.php#L63)
 * That’s why. You’re not triggering the do_action because the form action doesn’t
   know what ?jmm-join-site is.
 *  Thread Starter [antoniorigo](https://wordpress.org/support/users/antoniorigo/)
 * (@antoniorigo)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/hardcode-join-this-site-buttonfunctionality/#post-5633067)
 * The plugin is activated, and works just fine with the shortcode con a blog post.
 * it doesn’t work on a custom_post harcoded.
 *  Plugin Author [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [11 years, 3 months ago](https://wordpress.org/support/topic/hardcode-join-this-site-buttonfunctionality/#post-5633080)
 * The code isn’t running on the hard coded page. You have to write your own action
   to call the do_action, or use the do_shortcode to embed it and not the form.
 * That’s in theory mind you.
 *  Thread Starter [antoniorigo](https://wordpress.org/support/users/antoniorigo/)
 * (@antoniorigo)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/hardcode-join-this-site-buttonfunctionality/#post-5633081)
 * Thanks, you’ve been a great help.
 * I finally managed to make this work with [WordPress Social Login](https://wordpress.org/plugins/wordpress-social-login/)
   and some custom code based on your plugin:
 *     ```
       if (isset($_POST['subscribe'])) {
           $blog_id = get_current_blog_id();
           $user_ID = get_current_user_id();
           $role = 'subscriber';
           add_user_to_blog($blog_id, $user_ID, $role);
       }
       ```
   
 *     ```
       <form action="?subscribe" method="post">
           <input type="hidden" name="action" value="subscribe">
           <input type="submit" value="Subscribe" name="subscribe" id="subscribe" class="button">
       </form>
       ```
   
 * Couldn’t have done it without you!

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

The topic ‘Hardcode [join-this-site] button/functionality’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/join-my-multisite_e0d5c8.svg)
 * [Join My Multisite](https://wordpress.org/plugins/join-my-multisite/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/join-my-multisite/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/join-my-multisite/)
 * [Active Topics](https://wordpress.org/support/plugin/join-my-multisite/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/join-my-multisite/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/join-my-multisite/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [antoniorigo](https://wordpress.org/support/users/antoniorigo/)
 * Last activity: [11 years, 3 months ago](https://wordpress.org/support/topic/hardcode-join-this-site-buttonfunctionality/#post-5633081)
 * Status: resolved