• When I add new subscribers in WordPress, they are assigned to subscribe to all categories through subscribe2.

    How can I change the code so that each subscriber added set to subscribe to the category with the same name as their User ID??

    Could you please tell me where in the code I make change so that each new subscriber added subscribe to the category with the same name as their User ID??

    Please help me.. deeply appreciate your help.

    http://wordpress.org/extend/plugins/subscribe2/

Viewing 15 replies - 1 through 15 (of 29 total)
  • what version are you using?

    Thread Starter jbyungrokim

    (@jbyungrokim)

    3.2.1

    @jbyungrokim,

    You’ll need to have a look at the register() function in the subscribe2.php file.

    How / When is the category for each user created? Provided it is done before that code is called you’ll have to remove the $all_cats code and replace the $cats variable with an array containing the new category ID that is created from your user name.

    Thread Starter jbyungrokim

    (@jbyungrokim)

    Can you please help me with the code??

    I am pretty new to PHP.. and I need to get this done as soon as possible.

    Categories named after the User IDs will be created beforehand.. All I need get done is each new subscriber getting assigned to the category same as their user ID when each subscriber is registered..

    I would deeply appreciate if you help me with the code..

    thank you so much in advance.

    @jbyungrokim,

    I can’t really help you when I don’t fully understand what you are trying to accomplish. Also, bear in mind that I write and provide the Subscribe2 code for free in an ‘as-is’ state. I’ll try to help point you in the right direction with the code but writing it for you does not pay my bills when I’ve got other paid work (outside of web site development) that does.

    Who or what creates the categories? Is this done by another plugin or by hand? If the categories exist first, are you expecting this to be an on-going system of sign up or is it just something you are doing for existing users? How may user accounts are we talking about?

    Thread Starter jbyungrokim

    (@jbyungrokim)

    I think when the administrator log in with user ID, that variable gets in memory.. and this same variable in memory will be the name of category new subscriber needs to get assigned to when new subscribers are added to WordPress.

    Categories will be created beforehand with the same user name as users with Administrator status. I will create these categories with the same name as future administrator’s user ID. And it will be done by hand.

    And this will be an on-going process. Whenever new administrators are added to the WordPress, new categories with their User IDs will be created by hand and I will create these categories myself.

    So each administrator will add subscribers, and when these administrators log in and add new subscribers, I wish these new subscribers get assigned to the category that has the same name as the administrator’s user ID.

    Please help me and tell me where and what code I should add.. in order for the category picked should be the same as administrator’s USER ID they use when they log in to the system, in order to add new subscribers.

    Thank you so much.

    @jbyungrokim,

    So to clarify and recap so that I’m certain I’m understanding you correctly.

    You are an admin level user. You are manually adding other admin level users and each of these users has a category named after them.

    Each of these admins you are adding then creates further users but at subscriber level and it is these subscriber level users who need to be added to the category named after the admin.

    If that is correct, why are you not using WordPress as a multisite install – that is pretty much what this would achieve with you being a global admin and each of your current administrators running their own sub-blog with their own set of users.

    Thread Starter jbyungrokim

    (@jbyungrokim)

    Many administrators will start off testing subscribe2 capabilities with WordPress site set up as I have described.

    After the testing, I will assign them the site for their own use.

    So in order to begin with, since I do not know which of these administrators will decide to use their own site with subscribe2, I need this set up for them to try out subscribe2 this way.

    That’s why I need the code changed accordingly as I have described.

    Please help me. I would deeply appreciate.

    @jbyungrokim,

    I think this is a really unwise of implementing what you are aiming to achieve and that you would be better served setting things up correctly using WordPress multisite from the start.

    You don’t seem to be inclined to do this though – any hack is going to MAYBE get things working but will probably break the overall function of subscribe2 in terms of category subscriptions – this is because you are asking for a hack to fix a problem that subscribe2 has not made.

    I am not prepared to test the code on my site (as it would invalid breaking them to duplicate your unusual set up) but what you need is something like the code below (I cannot be sure it will work though). This replaces lines 1237 to 1247.

    global $currentuser;
    
    $cat_name = get_term_by('slug', $currentuser->user_login, 'category');
    $cats = $cat->term_id;

    This presumes that the category slug name is the same as the current user login.

    @ jbyungrokim,

    Whoops, there a variable name typo in that code, it should be:

    global $currentuser;
    
    $cat = get_term_by('slug', $currentuser->user_login, 'category');
    $cats = $cat->term_id;
    Thread Starter jbyungrokim

    (@jbyungrokim)

    I need a little correction on how the code be..

    what if the category be the same as User ID of people being added, not User ID of people logged in and adding the Users..

    Could you please tell me how I should update the code above, if the category is the same as the User ID of the people being added..???

    Thank you so much.

    @jbyungrokim,

    If the category slug is the same as the user login, what do you want the code to do? You haven’t said.

    Thread Starter jbyungrokim

    (@jbyungrokim)

    I need this code in order to add new Admins as a super admin myself.

    In this case, since the log in ID is my ID as super Admin, I need to assign each Admin I add, subscribing to the category with the same name as their user ID being created, not Log In ID.. Log In ID in this case is Super Admin (mine)’s User ID.. so doesn’t work with the previous code.

    So can you please help me with the code?? I need to assign category not same as the log in ID, but User ID being created.

    thanks million times.

    @jbyungrokim,

    global $current_user;
    
    if ( $current_user->ID == 'enter your ID here' ) { return ; }
    
    $cat = get_term_by('slug', $current_user->user_login, 'category');
    $cats = $cat->term_id;

    This will not carry out any subscription addition if the user is being added by you. You can than manually edit the subscription of the new admin user from Tools->Subscribers to subscribe them to their own category. Any users these individual admins then add will get subscribed to the category named after them.

    Thread Starter jbyungrokim

    (@jbyungrokim)

    I have found a plugin, import-users-from-csv.0.2.2.

    Using this plug in, I can import many users all at once. And this plug in allows importing customer user meta field values.

    I need the name of the field that designates the category name each user will subscribe to.

    Can you tell me what field name should I use in order to mass import users using import-users-from-csv.0.2.2 please??

    thank you.

Viewing 15 replies - 1 through 15 (of 29 total)
  • The topic ‘[Plugin: Subscribe2] subscriber category’ is closed to new replies.