WordPress.org

Ready to get started?Download WordPress

Forums

Join My Multisite
[resolved] [closed] Few modifications (31 posts)

  1. madri2
    Member
    Posted 1 year ago #

    Hello,

    I'm trying this plugin and i see that the new registration page doesn't use the localisations of the wordpress core.
    Can you use the same sentances that the original register page and use the localisation of wordpress core ?

    And also, unfortunately, even on a subsite, the page says "get a user accounts on *name of the network*" instead of *name of the subsite*

    And another problem, is that when i go on the wp-login page, if i clic on the register link, it redirect me to the main site instead of that new registration page.

    http://wordpress.org/extend/plugins/join-my-multisite/

  2. Ipstenu (Mika Epstein)
    Half-Elf Support Rogue & Mod
    Plugin Author

    Posted 1 year ago #

    The strings had to be changed because not all of the form gets used. It's not a 1-1 copy from wp-signup.php in order to prevent collisions and errors when running with certain themes. If you want to submit a translation, the plugin is localized so I'm happy to take any files. I used MOST of the same sentences (whenever I could), but localized per the plugin. That's what happens when you strip out the site creation stuff.

    And that is also the reason why it still says "get a user accounts on *name of the network*" instead of *name of the subsite* you see :) I didn't override the defaults.

    Finally, why the wp-login page still sends you to the default... is because I have no way to easily detect you came from there. You'll have to handle that on your own, by .htaccess redirects per site.

  3. madri2
    Member
    Posted 1 year ago #

    while looking at the code, i found in singuppage.php, function validate_user_signup,
    this code

    if ( 'blog' == $_POST['signup_for'] ) {
    		signup_blog($user_name, $user_email);
    		return false;
    	}

    but i don't want users to be able to create a blog

    the form does not contain the menu to choose between a blog or just a username, but if the user modify the request manually, he will be able to create a blog anyway, while it shouldn't
    this is quite a big security bug

  4. madri2
    Member
    Posted 1 year ago #

    for some reason unknown to me,
    $current_site return the main site and $current_site->blog_id is wrong
    but the global var blog_id return the right blog id

    on function signup_user you should use :
    global $blog_id;
    $blog_details = get_blog_details($blog_id);

    instead of
    $blog_details = get_blog_details($current_site->blog_id);

  5. Ipstenu (Mika Epstein)
    Half-Elf Support Rogue & Mod
    Plugin Author

    Posted 1 year ago #

    If you don't want users to create a blog, you turn off the option in the network for that. It's not the scope of the plugin and it's not a security bug or a bug at all. Are you trying to only allow -some- blogs to allow users to create blogs? Otherwise, just turn it off and move on.

    $current_site return the main site and $current_site->blog_id is wrong but the global var blog_id return the right blog id

    I'll check but it was working fine for me.

  6. madri2
    Member
    Posted 1 year ago #

    the option to prevent the users to create a blog is checked, but i think that
    "signup_blog()" does not take into account that parameter
    i think the parameter is only here to check if that function should be called or not
    i only want that the super admin can create a blog

    also, i've found out how to redirect the registration button to the page you defined in the settings

    in shortcode.php, at the beggining, add :

    function jmm_signup_location($val) {
    	$jmm_options = get_option( 'helfjmm_options' );
    	if ( !is_null($jmm_options['perpage']) && $jmm_options['perpage'] != "XXXXXX"  )
    		{ return get_permalink($jmm_options['perpage']); }
    	return $val;
    }
    add_filter('wp_signup_location', 'jmm_signup_location');

    because when the url /wp-login.php?action=register
    is get, the filter wp_signup_location is hooked to checked if we want a special location for the registration.

    By default, it will redirect to network_site_url('wp-signup.php') which will use "$current_site" to know the path, but current_site equals the main site, not the current blog... so it redirect to the main site

    edit1:
    signup_blog (in case wpmu_signup_blog) will not do any parameter verification
    http://codex.wordpress.org/WPMU_Functions/wpmu_signup_blog
    http://wpseek.com/wpmu_signup_blog/

    so you should verify the setting before calling that function

    edit2:
    i don't really understand why you didn't used the localisations from wordpress. Remove the 'helfjmm' at every translation and it will work. I don't see any reason to not work with some themes.
    Also, the button to register is labelled as "Register" and not "Sign Up" in the wordpress registration page

    edit3:
    here is a diff with the changes I proposed:
    http://uptobox.com/n66h0w71go9a/diff.html

  7. madri2
    Member
    Posted 1 year ago #

    signup_blog (in case wpmu_signup_blog) will not do any parameter verification
    http://codex.wordpress.org/WPMU_Functions/wpmu_signup_blog
    http://wpseek.com/wpmu_signup_blog/

    so you should verify the setting before calling that function

  8. madri2
    Member
    Posted 1 year ago #

    edit4:
    oh, and it's
    printf( __( 'Get your own %s account in seconds'), $blog_details->blogname )
    instead of
    printf( __( 'Get a user account on %s in seconds'), $blog_details->blogname )

  9. Ipstenu (Mika Epstein)
    Half-Elf Support Rogue & Mod
    Plugin Author

    Posted 1 year ago #

    the option to prevent the users to create a blog is checked, but i think that "signup_blog()" does not take into account that parameter

    I cannot reproduce this. I installed on a fresh instance of WP, set up my network to ONLY permit users to create accounts, and the signup page is not only just for accounts, but it keeps the user on the page, on that site. Works exactly as expected (with an empty param warning I'll fix).

    You'll need to explain, in clearer detail, what your setup is on the network (what registration option did you pick), and what ones you picked on the site, if you want me to debug this fully. Right now, using the plugin as I intended, it does what I intended, so I can only guess you're doing something unexpected :) That's not BAD, but I want to make sure it's within the scope of what I want to support and maintain.

    What I did:

    1) Network settings - Users can register
    2) Network activated the plugin
    3) Per site: manual registration, checked 'per site' and picked my page 'join.'
    4) Put the shortcode in join

    Then as a logged out user, I went to join and it correctly showed me just what I should see: http://cl.ly/image/3z0M1s3x2O3i

    Also, the button to register is labelled as "Register" and not "Sign Up" in the wordpress registration page

    That brings up exactly why I use helfjmm.

    The reason I'm using helfjmm is that if WP changed and I wasn't, everything would break. On the other hand, if I use my own and people submit language packs, I'll add them and no one will break. I'm not going to change it back right now, it works the way I want it to. If you want to submit a language pack, I'll add it and credit you :)

    In the next version of WP it will be Signup (one word).

    I'm fixing the param warning, and cleaning the translation. Submissions always welcome.

  10. madri2
    Member
    Posted 1 year ago #

    there is an empty input containing
    <input id="signupblog" type="hidden" name="signup_for" value="user" />

    if by example, you save the page in your hard drive and change it to value="blog" (or you can use the plugin tamper data in firefox to change it on the fly to blog ), your plugin will interpret it as a blog creation

    did you looked at my code to redirect automatically to the right page and to display the name of the blog instead of the main site ?

    for the strings, then the best thing to do will be to extract the strings from the default language pack and import them to your project :)

  11. Ipstenu (Mika Epstein)
    Half-Elf Support Rogue & Mod
    Plugin Author

    Posted 1 year ago #

    for the strings, then the best thing to do will be to extract the strings from the default language pack and import them to your project :)

    That's subjective. I don't want to, I would rather use them as a starting point, to allow me to customize both layout and language. Take it or leave it.

    there is an empty input containing
    <input id="signupblog" type="hidden" name="signup_for" value="user" />

    That's supposed to be there. It's required (and if you read wp-signup.php, you'll see it's there too):

    <p>
    		<?php if ( $active_signup == 'blog' ) { ?>
    			<input id="signupblog" type="hidden" name="signup_for" value="blog" />
    		<?php } elseif ( $active_signup == 'user' ) { ?>
    			<input id="signupblog" type="hidden" name="signup_for" value="user" />
    		<?php } else { ?>
    			<input id="signupblog" type="radio" name="signup_for" value="blog" <?php checked( $signup_for, 'blog' ); ?> />
    			<label class="checkbox" for="signupblog"><?php _e('Gimme a site!') ?></label>
    			<br />
    			<input id="signupuser" type="radio" name="signup_for" value="user" <?php checked( $signup_for, 'user' ); ?> />
    			<label class="checkbox" for="signupuser"><?php _e('Just a username, please.') ?></label>
    		<?php } ?>
    		</p>
    
    		<p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e('Next') ?>" /></p>

    Plugin don't work without it, I tried.

    did you looked at my code to redirect automatically to the right page and to display the name of the blog instead of the main site ?

    I did and again, I can't reproduce it NOT redirecting correctly. If you're not willing to give me the info I asked for, I can't help you with that. When I make a custom registration page, I'm always redirected to where I expect.

    Are you still on about how going to domain.com/site/wp-login.php and clicking register THERE sends you to the wrong place?

    As for the name of the blog vs main site, I'm thinking about it.

  12. madri2
    Member
    Posted 1 year ago #

    okay, i was wrong about the modification to value=blog

    for the redirection, sorry for the lack of details
    my params:
    Network settings - Users can register

    the plugin conf:
    Membership : none
    Registration Per-Site
    and a custom registration page configured

    the "register" button on wp-signup looks like that :
    http://www.subsite.com/wp-login.php?action=register
    and redirect to :
    http://www.mainsite.com/wp-signup.php

    mainsite.com is the blog 1 and the site 1
    subsite is the blog 2 and is in the site 1

  13. Ipstenu (Mika Epstein)
    Half-Elf Support Rogue & Mod
    Plugin Author

    Posted 1 year ago #

    You're on the wrong page: http://subsite.com/custompage

    Why are you going to http://www.subsite.com/wp-signup.php ?

  14. madri2
    Member
    Posted 1 year ago #

    oops i mean wp-login instead of "the register button on wp-signup" -> "the register button on wp-login"

    i go on http://www.subsite.com/wp-login.php
    i click on register button, which redirect on the http://www.mainsite.com/wp-signup.php

  15. Ipstenu (Mika Epstein)
    Half-Elf Support Rogue & Mod
    Plugin Author

    Posted 1 year ago #

    Same answer. You're going to the wrong page :)

    Go to subsite.com/custompage

    You know that page you said you made when you said "and a custom registration page configured"? Go there.

    This plugin does not change /wp-login.php nor does it change wp-signup.php

  16. madri2
    Member
    Posted 1 year ago #

    yes but imagine you are a guest, browsing the site
    you click on "login", and then you see that you don't have an account, then you click on register to register on the website. but the url is not the custompage.

    I provided you some code to replace the link of "wp-signup" to "custompage" automatically !

  17. Ipstenu (Mika Epstein)
    Half-Elf Support Rogue & Mod
    Plugin Author

    Posted 1 year ago #

    Eh..... I mentioned before I didn't do that on purpose. I'll think about it. More people use the widget sidebar for login and registration there, so they can control things. No promises.

  18. madri2
    Member
    Posted 1 year ago #

    another example, when the user click on the activation link on the email, they go on a page which say
    you account is activated, you can sign in here
    and the link goes to wp-login :)

  19. madri2
    Member
    Posted 1 year ago #

    sorry but you made some mistakes.
    a callback for a shortcode should return the text, and not echoing it.
    jmm_shortcode_func
    does not return the text.

    i think you should replace it to :

    function jmm_shortcode_func( $atts, $content = null ) {
    
        add_action( 'wp_head', 'wp_no_robots' );
        $wp_query->is_404 = false;
    	ob_start();
       include_once( PLUGIN_DIR. '/lib/signuppage.php');
    	return ob_get_clean();
    }

    also, on signup page, you use
    do_action( 'after_signup_form' );
    but you forgot the action "before_signup_form"
    and that messup my theme ;)

    oh, and another problem,
    you copied this:
    <div id="content" class="widecolumn">
    to the signup page
    but wp-signup.php is a PAGE, while "signuppage.php" is a CONTENT, displayed on some part of the page.

    Therefore, there are two div with id "content", because yours shouldn't be used
    i think you should also remove the class widecolumn (or better, remove that div)

  20. Ipstenu (Mika Epstein)
    Half-Elf Support Rogue & Mod
    Plugin Author

    Posted 1 year ago #

    PLEASE pleas please please please learn to use the code tags, eh? It's a nightmare reading code when you don't.

    What theme are you using?

    another example, when the user click on the activation link on the email, they go on a page which say
    you account is activated, you can sign in here
    and the link goes to wp-login :)

    How is that wrong? The email SHOULD send them to where they login.

    ETA: Why ob_start/close?

    In general, it's a bad idea to use output buffering unless there's no other way to do it. In the case of the given code, and so far as I can tell, there are no errors with the way it is now.

  21. madri2
    Member
    Posted 1 year ago #

    i'm using pagelines as theme
    i've added do_action( 'before_signup_form' ); and removed the div with the id content in your plugin and it worked.
    About the ob start, like i said, a shortcode hook should return the text and not "echo" it, it can lead to visual problems with some configurations

  22. Ipstenu (Mika Epstein)
    Half-Elf Support Rogue & Mod
    Plugin Author

    Posted 1 year ago #

    I agree the do_action needs to be in there, that's an oversight.

    I question your theme, because the div with content is exactly what the actual signup page does, and it works just fine on the default themes, and any other I've tested with so I wonder if there's something special going on that causes problems.

    I get the return vs echo, I don't get why ob_start. Again, output buffering bad :)

  23. madri2
    Member
    Posted 1 year ago #

    yes but the signup page is a page, i mean nothing else than this page will be executed. It contains the template of the whole page.

    But with your shortcode, the template of the page will be defined and your "singuppage.php" will be placed inside that template

    that's why you didn't included, by example, the :
    <?php get_footer(); ?>
    which you can found inside wp-singup

    the reason of the ob_start, it's because in your signup page (included inside the callback of the shortcode), you do a lot of echo.
    But, like i said, in a callback of a shortcode, you should RETURN a string containing the data you want to display, and not "echo" it !
    while it may works in most of the configurations, some times i've seen random problems caused by this kind of mistake ;)

  24. Ipstenu (Mika Epstein)
    Half-Elf Support Rogue & Mod
    Plugin Author

    Posted 1 year ago #

    I'd appreciate actual details on the 'random problems.'

    Also what specs is the server where you tested this? Versions of PHP etc ;)

  25. madri2
    Member
    Posted 1 year ago #

    i don't remember the exacts problems, i think it was with filters, with the content displaying in the wrong place, because the echo was done "too early", but filters works a little differently, because a filter can have multiple callbacks, so if you echo the data instead of returning it, the second callback will not have access to the data

  26. madri2
    Member
    Posted 1 year ago #

    PHP 5.3.3-7+squeeze15
    Apache/2.2.16
    w3 total cache

  27. madri2
    Member
    Posted 1 year ago #

    don't forget to thank me in the changelog ;)

  28. madri2
    Member
    Posted 1 year ago #

    thanks for the kudos ;)

    what do you think about the removing of that:
    <div id="content" class="widecolumn">

    and the "return" instead of echo ?

  29. Ipstenu (Mika Epstein)
    Half-Elf Support Rogue & Mod
    Plugin Author

    Posted 1 year ago #

    I'm thinking about it (and I haven't finished that release, since I'm busy with the work that pays me ;) )

    The problem is that if you don't have the id=content, there are issues with other themes. I want a more elegant way of handling that.

    Also if I COULD switch to return, I would, but I don't want to rejigger the entire page that much. Too much work in the long run for not enough benefit. It introduces too much human error if I go and re-write the functional login page. I've already made enough changes.

    I have not tested the ob flushes fully (I don't know if it would cause other hooks from other plugins to break). Since the reason one would put it there would be to prevent errors, and there are none happening that I can find with this implementation, I'm leaning towards 'It's not broken, don't screw around with it.'

    BTW, I have other posts where people reported that using the default WP translation did NOT work, so I'm sticking with using my own.

  30. madri2
    Member
    Posted 1 year ago #

    but there WILL be a id=content on the page
    if this div is absent, it means that the theme isn't displaying it.
    But with your code, we have two div with the same id, and the layout is abnormal because of the class

    okay for the translation, i will then provide a translation file for french

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.