• Resolved VentureCore

    (@manakio2k)


    I’m having an interesting problem that I’m not sure how to resolve.

    First let me say thank you for contributing this application to the WP community, this plugin has been on and off my radar for some time now and I was referred to it by another one of your users who uses it on several networks.

    The problem I’m experiencing is ‘Logging In’ when a user returns. I’ve activated the plugin and set it up to take advantage of the widget to manage adding visitors to each of our subsites. I have the “show in-line login form activated but after logging out and returning the login form is not letting me log in which I understand may be a conflict with another plugin but not sure how to determine which.

    I’m assuming (of course) that by checking that box it’s supposed to make it possible to log back into the subsite without logging into the main site which is what I have to do right now.

    Any thoughts or suggestions would be appreciated.

    Thanks!

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author Ipstenu (Mika Epstein)

    (@ipstenu)

    πŸ³οΈβ€πŸŒˆ Advisor and Activist

    I’m assuming (of course) that by checking that box it’s supposed to make it possible to log back into the subsite without logging into the main site which is what I have to do right now.

    Yes and no.

    It’s a multisite. If you’re logged into one site, you’re logged into all sites (depending on cookies). After all it’s one user account for the whole network πŸ™‚

    after logging out and returning the login form is not letting me log in

    The only way to debug is to turn off other plugins until it works. But. What ‘error’ are you getting?

    Thread Starter VentureCore

    (@manakio2k)

    WOW, Thank you so much for getting back to me as fast as you did. I’m just now getting caught up on messages.

    It appears as though it does have to do with cookies but I’m not sure where to start.

    The way we have our sites configured (this is the second time I am trying to implement this plugin, last time I tried was over a year ago), users can have individual accounts with separate info on each subsite.

    So far it is behaving great (accept)

    We are registering members on the main network site. Like I said, our setup allows for individual accounts on each subsite.

    The user is redirected to a subsite based on the site they select when they register. If I have the subsites set to auto add, it does that beautifully (but that’s not what we want) We still want them to ‘Activate’ their account on the subsite they selected AND any other subsite they visit. All of the subsites retain the TLD name and each subsite has content centered around different subjects.

    The Problem:
    When we have this plugin setup for ‘Manual’ activation (we are using the widget), it is clear to the user they still need to “Activate” their account on that subsite. However, when they visit one of the ‘other’ subsites it shows the link to their profile page “On That Site” (which works BTW) but in the backend it does not add them or show them as a user (that’s good, it means they are not really added to the subsite yet). (Unless they click the ‘Activate’ button which they can’t see, find or even realize exists because the link in the menu says “XYZ Account” and not “Activate” which would send them to the ‘login/activation’ and THEN to their profile page. Crazy I know but I’m thinking either this plugin or something else is setting the plugin ‘Network’ wide when we want the cookies to be ‘Site by Site’. Make sense??!

    I’m pushing the envelop when it comes to how I have setup sites in the past so this is new territory to a small extent but one that would open major doors once we wrap our brains around the way it is working.

    Any suggestions or help you can offer would be appreciated more than words could say and I’d be happy to cover your time if you could help us find a solution.

    Thanks again for getting back to me so fast. I hope you can repeat that! πŸ™‚

    Have a great day…

    • This reply was modified 6 years, 4 months ago by VentureCore.
    • This reply was modified 6 years, 4 months ago by VentureCore.
    Thread Starter VentureCore

    (@manakio2k)

    I read an article on your site that said to add this:

    define(‘ADMIN_COOKIE_PATH’, ‘/’);
    define(‘COOKIE_DOMAIN’, ”);
    define(‘COOKIEPATH’, ”);
    define(‘SITECOOKIEPATH’, ”);

    We are also having problems if someone logs out they can’t log back in.

    This worked great but then when visitor goes to the ‘Login | Activation’ page it does not autofill the secondary text so they can add themselves to the site. Even if they log in to a separate subsite they are not added as a user.

    We are also using Buddypress but if we set plugin to auto-add visitors they are added and they have a profile/account page but we don’t want to confuse them if they don’t want to be added to the other subsites.

    Help!

    Thread Starter VentureCore

    (@manakio2k)

    Current wp-config.php settings:

    # Misc Management Settings
    define( ‘WP_DEBUG’, false );
    define( ‘WP_DEBUG_LOG’, false );
    define( ‘WP_DEBUG_DISPLAY’, false );
    // define( ‘WP_ALLOW_REPAIR’, true );
    // https://mysite.com/wp-admin/maint/repair.php

    # Multisite Settings
    define( ‘SUNRISE’, ‘on’ );
    define( ‘WP_ALLOW_MULTISITE’, true );
    define( ‘MULTISITE’, true );
    define( ‘SUBDOMAIN_INSTALL’, true );
    $base = ‘/’;
    // define( ‘DOMAIN_CURRENT_SITE’, ‘mysite.com’ );
    // define( ‘DOMAIN_CURRENT_SITE’, $_SERVER[‘HTTP_HOST’] );
    define( ‘PATH_CURRENT_SITE’,’/’ );
    // define( ‘WP_HOME’, ‘http://’ . $_SERVER[‘HTTP_HOST’] );
    // define( ‘WP_SITEURL’, ‘http://’ . $_SERVER[‘HTTP_HOST’] );

    // define( ‘SITE_ID_CURRENT_SITE’, 1 );
    // define( ‘BLOG_ID_CURRENT_SITE’, 1 );
    // define( ‘DO_NOT_UPGRADE_GLOBAL_TABLES’, true );

    // define( ‘ADMIN_COOKIE_PATH’, ‘/’);
    // define( ‘COOKIE_DOMAIN’, ”);
    // define( ‘COOKIEPATH’, ”);
    // define( ‘SITECOOKIEPATH’, ”);

    Most lines commented out but we keep them in file for testing. I actually already had to bottom four lines in the config file so all I had to do is uncomment them.

    If there is a better setup than this please do tell!! πŸ™‚

    p.s. Also Multi Network

    Thread Starter VentureCore

    (@manakio2k)

    My last post is being held for moderation. WTH, I have NEVER seen this. I’m hurt wp.org people!!!

    Plugin Author Ipstenu (Mika Epstein)

    (@ipstenu)

    πŸ³οΈβ€πŸŒˆ Advisor and Activist

    The post on my site was regarding a kinda different issue with subdomains, mapped domains, and cookies. But … that may actually be the issue here…

    The plugin isn’t adding any cookies. It’s just … WordPress.

    However, when they visit one of the β€˜other’ subsites it shows the link to their profile page β€œOn That Site” (which works BTW) but in the backend it does not add them or show them as a user (that’s good, it means they are not really added to the subsite yet).

    It sounds like you want to change that code to show the profile page link to check if they’re members of that site before they show it?

    edit: Sorry about the moderation. When you post too many times too fast, Akismet gets nervous and runs around like a chicken without a head. Don’t be hurt. It’s happened to literally everyone. Myself included.

    Thread Starter VentureCore

    (@manakio2k)

    Basically I don’t want the site to show the link to their profile page in the main menu at all until they have added themselves to the site via the JMM activation link. When they register on the main site, they are added to the main site and then redirected to the ‘Activation’ page of the subsite they selected on the registration form. As it is currently configured, they are successfully being sent to the activation page and the ‘CLICK HERE TO ACTIVATE YOUR (custom-name) ACCOUNT!’ link text (placed in the “Not a member of this site:” field of your plugin’s widget) shows up perfectly (but… if they just so happen… to look up at the main menu… they will see the ‘(custom-name) Account’ link is active (basically it’s just a reworded ‘your-profile’ link) but they have not been ‘added’ to the site yet. πŸ™

    So… if this plugin does not add any cookies, how does it know you are registered on the main site and to show the new user the ‘add me to this site’ link?

    Sounds like I need to be able to somehow override or define the main-site cookie or?…

    Hopefull? πŸ™‚

    Any help or insight would seriously be appreciated. It’s too late to re-figure this out. We are basically live and we had 16 people sign up today (it’s through our local school district) and I have to manually adjust a couple of things for the time being. Problem is by the time we’re done we will have two to three thousand registered by the end of December (based on historical activity on our old site that did not provide member profiles)

    Wanna trade places???

    • This reply was modified 6 years, 4 months ago by VentureCore.
    Plugin Author Ipstenu (Mika Epstein)

    (@ipstenu)

    πŸ³οΈβ€πŸŒˆ Advisor and Activist

    So… if this plugin does not add any cookies, how does it know you are registered on the main site and to show the new user the β€˜add me to this site’ link?

    It uses https://developer.wordpress.org/reference/functions/is_user_member_of_blog/ which is a core function. I try hard not to reinvent wheels πŸ™‚

    Basically I don’t want the site to show the link to their profile page in the main menu at all until they have added themselves to the site via the JMM activation link.

    Right! So you can wrap whatever code you use for that link with is_user_member_of_blog too!

    
    $current_user = wp_get_current_user();
    if ( 0 !== $current_user->ID && is_user_member_of_blog( $current_user->ID ) {
        // show the link
    }
    

    (If we trade places you have to call Amazon about a terms violation and explain what ‘education’ means… I don’t think you want that.)

    Thread Starter VentureCore

    (@manakio2k)

    I will give this a try and let you know if it solved my problem πŸ™‚

    So… sorry but your last comment confused me (and that’s not easy) πŸ™‚

    I think that needs a splaner vid attached!!

    Real quick, so that is a standard wordpress menu item that goes away if you’re logged in and shows up if you are not. Think of me as a Senior in High School (12th grade) I know enough to accomplish surprising things but not enough to keep me out of trouble…

    Where should I put that? πŸ™‚

    Thanks!

    Plugin Author Ipstenu (Mika Epstein)

    (@ipstenu)

    πŸ³οΈβ€πŸŒˆ Advisor and Activist

    I understand πŸ˜€

    Making a conditional menu item is a lot harder.

    I would probably cheat and install this: https://wordpress.org/plugins/if-menu/

    You could then add in a filter like this:

    
    add_filter( 'if_menu_conditions', 'venturecore_new_menu_conditions' );
     
    function venturecore_new_menu_conditions( $conditions ) {
      $conditions[] = array(
        'name'    =>  'If the user is on THIS site',
        'condition' =>  function( $item ) {
          // callback - must return TRUE or FALSE
          $current_user = wp_get_current_user();
          return if ( 0 !== $current_user->ID && is_user_member_of_blog( $current_user->ID );
        }
      );
     
      return $conditions;
    }

    What that does is adds in a new rule to if-menu “If the user is a member of THIS site” – Then you make your menu conditional to if that’s true.

    In theory, the default ‘logged in to this site’ should do that too, but I’m not 100% sure.

    Thread Starter VentureCore

    (@manakio2k)

    Thank you for all your help. It is appreciated very much!

    I will let you know how or if it works πŸ™‚

    Thread Starter VentureCore

    (@manakio2k)

    Thank you for this Mika,

    Based on this we were able to create a custom rule and with If Menu it worked great.

    However, I do have another problem now.

    We currently have JMM setup for ‘Manual’ adding users.
    Here is what our page looks like. As soon as you have visited this I’m going to delete this short URL http://dxi.bz/supaf

    Right now we have it setup so as soon as a user registers on the main network site, based on the section they choose they are redirected to the subsite and login-activation page. Where is says ‘Click Here to Register’ is then replaced with an ‘Activate Your Account’ link. The only problem has been that if they leave and then come back and want to also register on another section, the link does not say ‘Activate My Account’, it defaults back to ‘Click Here to Register’. Nevertheless, they can login and even be redirected to a ‘Profile Page’ on the new subsite but they are not ‘Added as a User’ (I know that sounds counter-intuitive) but that’s what happens. We are using the plugin “Login With Ajax” which when a user logs in they are taken directly to their profile profile page.

    What would be nice is if they could be “Added as a User” two ways. #1 Click the ‘Activate My Account’ link & #2 Simply ‘Log In’ to the subsite which would also then ‘add’ them as a user.

    Any chance you could help us with a snippet to do this?

    Thanks again for your help, we’ll be sure to send you a token of our appreciation πŸ™‚

    • This reply was modified 6 years, 4 months ago by VentureCore.
    Plugin Author Ipstenu (Mika Epstein)

    (@ipstenu)

    πŸ³οΈβ€πŸŒˆ Advisor and Activist

    That’s going to be a bit of custom code similar to what you did for the menu and using is_user_member_of_blog

    I don’t have the availability right now to sit and write exactly what you need. :/

    Thread Starter VentureCore

    (@manakio2k)

    No worries, We have made some milestones on some other controls that might make it possible for us to change it back to automatic. Fingers crossed!

    Thank you for taking the time to reply!

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Interesting Issue’ is closed to new replies.