Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'group_id'

Viewing 25 results - 476 through 500 (of 564 total)
  • Author
    Search Results
  • #78419
    Marcella
    Participant

    Thanks guys, upon inspecting a plugin with similar functionality then finding one with the exact functionality came accross this code.
    $new_member = new BP_Groups_Member;
    $new_member->group_id = $group_id;
    $new_member->inviter_id = 0;
    $new_member->user_id = $user_id;
    $new_member->is_admin = 0;
    $new_member->user_title = ”;
    $new_member->date_modified = time();
    $new_member->is_confirmed = 1;

    Which is a good insight of how to use a BP class in the future.

    There were no actions being called on the WPDB query, would that be a reason why?

    Unrelated note here, wouldn’t it be wise to advise plugin devs who utilise jQuery and default UI theme to rename their CSS class selectors as it always annoyingly clashes.

    It’s either that or all theme developers have to rename theirs. A duel *slap :p

    Thanks for help

    #78403
    Anonymous User 96400
    Inactive

    That’d be
    `groups_join_group( $group_id, $user_id );`

    As for the class, you instantiate it, set all the variables and then call the save() method.

    I was asking for the action hooks before. Maybe that’s why it runs 3 times…

    #78036
    Kent
    Participant

    I was also having this problem in clean installs of WP 2.9.2 + BP 1.2.3. I finally tracked the cause down to this: https://trac.buddypress.org/changeset/2882/trunk. Basically there’s a defect in the script that inserts the initial row into the xprofile fields table (wp_bp_xprofile_fields). A workaround (if you have SQL access) is to run these 2 statements:

    ALTER TABLE wp_bp_xprofile_fields modify order_by varchar(15) not null default ”;
    INSERT INTO wp_bp_xprofile_fields (id, group_id, parent_id, type, name, description, is_required, can_delete)
    VALUES (1, 1, 0, ‘textbox’, ‘Name’, ”, 1, 0);

    After I executed those statements, it shows my group members.
    Note that the changeset also added a default for order_by, so I’m guessing that caused problems as well.

    #77749

    @3sixty: I experienced exactly the same misbehaviour in my blog = invitation sent, membership requested by the blog member, confirmed twice somehow and… boing, 2 memberships of the same member in a single group.
    Is it still there in your blog or could you fix it?

    I wonder if it was sufficient to simply delete the doubled/second group-member-relation entry from the MySQL wp_bp_groups_members table? Or does this have any negative side effects?
    A more gentle alternative could be to set the group_id field of this entry to a non-existing group 999 or so. Shouldn’t do any harm unless the 999th group is created and an uninvited member pops out of nowhere…

    Cheers,
    Hans

    #76397
    WPChina
    Participant

    Ok, I did this the “difficult way” by directly adding into the database. I wish there was a much easier way to handle this :(

    Here is the code I used — you need to tweak it for your won requirenents based on how your setup exists:

    Code:
    INSERT INTO `wp_bp_xprofile_fields` (`id`, `group_id`, `parent_id`, `type`, `name`, `description`, `is_required`, `is_default_option`, `field_order`, `option_order`, `order_by`, `can_delete`) VALUES
    (number1, 6, 66, ‘option’, ‘CHOICE1’, ”, 0, 0, 0, 2, ”, 1),
    (number2, 6, 66, ‘option’, ‘CHOICE2’, ”, 0, 0, 0, 3, ”, 1);
    #75775
    Paul Wong-Gibbs
    Keymaster

    Not bp_profile_fields; function bp_has_profile() does if that’s any use? It only takes user_id and profile_group_id.

    #75561
    Paul Wong-Gibbs
    Keymaster

    What about something like does? You’ll have to dump the var to check what it contains.


    $group = new BP_Groups_Group( $group_id );

    #74723

    In reply to: Duplicating Components

    Boone Gorges
    Keymaster

    Yes, it should be possible, but it’d be pretty complicated, as the codebase for the groups component is pretty large and complicated. An alternative method might be to add a piece of groupmeta to certain groups flagging them as ‘companies’, and then using that metadata to enable the separate display of company-groups and non-company-groups around the site. Or, what might be easier given the way that bp_has_groups is written (and given the fact that your company filters would largely be on the output of bp_has_groups) is to store an array somewhere of group_ids corresponding to company-groups and non-company-groups, and then feed it as the $include argument to bp_has_groups in your theme template.

    Paul Wong-Gibbs
    Keymaster

    So, yes, by default, the register page only shows group 1 (the “base” group). You only retrieve one group via the profile_group_id= parameter in the bp_has_profile() call.

    So, by default, this happens:

    What I’m trying to accomplish is to hide groups 3 and 4 on the registration page not to overwhelm the user with a bunch of fields to fill out during sign-up, those fields can be filled out once the user has activated her/his account via “edit profile”.

    There have been other threads on the forum regarding showing more than one profile group on the registration page; I found several, but take a look at https://buddypress.org/forums/topic/all-fields-for-registration. It’s probably going to be really difficult to implement unless you have a decent understanding of PHP.

    jivany
    Participant

    Nope, I don’t think so. I was thinking you could remove the ‘profile_group_id=1’ arg from bp_has_profile but that doesn’t seem to allow the registration page to show more groups. I guess it appears that the only “required” fields for registration are the required ones in the Base group.

    Might be worth opening a ticket on this one to see if that is the expect behaviour. Alternatively, ping R-a-y or DJPaul and see if they know.

    Gene53
    Participant

    Nope, only getting group 1. I wonder if:

    <?php if ( function_exists( 'bp_has_profile' ) ) : if ( bp_has_profile( 'profile_group_id=1' ) ) : while ( bp_profile_groups() ) : bp_the_profile_group(); ?>

    can be modified to fetch group 2 also.

    LOL, this is driving me nuts…

    jivany
    Participant

    OK. I’m thinking you can do something like this. Find this part of the file in register.php:

    <?php /***** Extra Profile Details ******/ ?>

    <?php if ( bp_is_active( 'xprofile' ) ) : ?>
    <div class="register-section" id="profile-details-section">

    <h4><?php _e( 'Profile Details', 'buddypress' ) ?></h4>

    <?php /* Use the profile field loop to render input fields for the 'base' profile field group */ ?>
    <?php if ( function_exists( 'bp_has_profile' ) ) : if ( bp_has_profile( 'profile_group_id=1' ) ) : while ( bp_profile_groups() ) : bp_the_profile_group(); ?>

    <?php while ( bp_profile_fields() ) : bp_the_profile_field(); ?>

    At this point, add in a line like:

    if( (bp_the_profile_group != "3") || (bp_the_profile_group != "4") ) :

    Then go down to this part of the file:

    <?php endwhile; ?>

    <input type="hidden" name="signup_profile_field_ids" id="signup_profile_field_ids" value="<?php bp_the_profile_group_field_ids() ?>" />

    <?php endwhile; endif; endif; ?>

    </div><!-- #profile-details-section -->

    Before the first endwhile line, insert this:

    <?php endif; ?>

    I *think* that should spit out groups 3 & 4 (assuming you have groups 3 & 4 defined in your profile groups). You might need to add in group “1” also to get the Base. The only part I’m not sure about right now is if the number need to be in double quotes or just bare. So it might be:

    if( (bp_the_profile_group != 3) || (bp_the_profile_group != 4) ) :

    I think. ;)

    rsqst
    Participant

    Ok, I think I’m close to knowing what I want; But I don’t seem to be much closer to getting there.

    Unfortunately, I think my main problem is that the members loop isn’t flexible enough in its parameters for what I want (I want to add it to a child template and for it to automatically show the users of the current blog AND their xprofile information. Seems simple, but I’m lost).

    I could hand code in each of users ID’s and get the exact output I want, but this means I have to make a new template for each blog/”art project”, and it doesn’t update automatically when a new artist is added to a project.

    There’s hope in the group members loop (I’m using the BP Groupblog plugin, so when users join a group, they are added to a blog), but I still have to enter in the group_id manually in the template.

    <?php if ( bp_group_has_members('group_id=1') ) : ?>

    <?php while ( bp_group_members() ) : bp_group_the_member(); ?>

    <?php $authorBio = xprofile_get_field_data( 'Bio', $user_id=bp_group_member_id() );

    echo 'Authors bio: '. $authorBio; ?>

    <?php endwhile; ?>

    <?php endif;?>

    But as it is, it outputs: 11Authors bio: 10Authors bio: 9Authors bio: 8Authors bio: 7Authors bio: 5Authors bio:

    Should I scratch the whole thing and find a new route?

    #72547

    Thank you. And what exactly do I do with that bit of code?

    #72270
    r-a-y
    Keymaster

    You’re right, Brajesh.

    Forgot about that function!

    #72268
    Brajesh Singh
    Participant

    The

    bp_get_group_id() will only work if you are on group page.

    In case you are not on group page and want to know the group id, there is a way to find that, but you will have to know the group slug(check the url of group for slug)

    $group_id=BP_Groups_Group::get_id_from_slug($slug);

    where $slug is the group slug.

    #72267
    r-a-y
    Keymaster

    Try:

    bp_get_group_id();

    #72266
    danbpfr
    Participant

    search your database for wp_bp_groups: the info is there, for sure !

    #72264

    I need the same information…

    Anyone?

    rich! @ etiviti
    Participant

    if you want to keep it all using bp functions, look at bp-groups.php

    I would set it up hooking on activating the user (or signup if you don’t care about the activation key)

    _action( 'bp_core_activated_user'

    then call (with no pagination passed in and active type)

    groups_get_groups(

    then loop over all the groups and call (which needs the user_id and group_id)

    groups_join_group(

    only downside to join_group is it will call a new activity for joining – but a plus side is it updates the groupmeta counts.

    *my standard disclaimer applies – only in theory nothing tested. :)

    #72027
    rich! @ etiviti
    Participant

    sounds easy enough to do, just need to edit the entry.php theme file and add some function around the reply button if the type is ‘new_forum_post’ or new_forum_topic (note: acomment-comment class invokes the jquery for the activity comment reply)

    if the activity action is ‘new_forum_post’ then the secondary_id is the post_id

    and i believe if a ‘new_forum_topic’ the primary_id is the forum_id (otherwise on new_forum_post it is the group_id)

    post_id or forum_id – you can grab the link to the group forum topic (some buried functions in bb or bp)

    (fwiw, i have a working demo of the activity comments on a forum reply post working now: http://etivite.com/groups/test-group/forum/topic/my-test-topic-to-pull-in-activity-stream-comments-on-a-topic-reply/#topic )

    #71721
    Brajesh Singh
    Participant

    hi Gene

    how about this one then

    <?php global $bp;
    if(bp_get_current_profile_group_id()==1)
    bp_core_redirect($bp->displayed_user->domain."profile/edit/group/2");
    ?>

    At the top of edit.php and removing the old code.

    but please note, the base field will be never editable and will not be shown, when ever user will click on edit base field, he will be redirected to edit the second groups field.

    let me know what do you think :)

    #71625
    Brajesh Singh
    Participant

    Simply, create a child theme, copy the members/single/profile/ edit.php to

    yourchild-theme/members/single/profile/edit.php

    Now modify it slightly,

    Like put his before the first line of edit.php

    <?php if(bp_get_current_profile_group_id()==1):?>
    <ul class="button-nav">
    <?php bp_profile_group_tabs(); ?>
    </ul>
    <div class="clear"></div>
    <?php
    locate_template(array("members/single/profile/profile-loop.php"),true);?>
    <p><b>Your Username is your identity and We hate to see you changing your identity, so our computer has decided to disable editing it for you.Please Edit all other data in your profile as you wish :)
    </b>
    </p>
    <?php
    else:?>

    and at the end of Edit.php put this line

    <?php endif;?>

    Now go and check your profile page.

    please let me know if it works or not

    #71592
    jivany
    Participant

    @gian-ava: For your second question, check out this post https://buddypress.org/forums/topic/faq-how-to-code-snippets-and-solutions#post-13243

    I haven’t tried this but it would suggest you could do something like:

    <?php if ( bp_has_profile('profile_group_id=9') || bp_has_profile('profile_group_id=7') ) : ?>
    <?php while ( bp_profile_groups() ) : bp_the_profile_group(); ?>
    <div id="widget1">
    <?php if (bp_the_profile_group() == "9") : ?>
    // Do whatever you want with group 9
    <?php endif; ?>
    <?php if (bp_the_profile_group() == "7") : ?>
    // Do whatever you want with group 7
    <?php endif; ?>
    </div>
    <? endwhile; ?>
    <?php endif; ?>

    The only part I’m not sure about is if you need the first call to bp_the_profile_group() on the second line (after the start of the while loop).

    #71411
    Gianfranco
    Participant

    And another thing I am trying know (Question #2) is if it is possible to use a conditional statement to check if more than 1 group has fileds that has been filled in and return something accordingly:

    <?php if ( bp_has_profile('profile_group_id=9') || bp_has_profile('profile_group_id=7') ) : ?>
    <?php while ( bp_profile_groups() ) : bp_the_profile_group(); if ( bp_profile_group_has_fields() ): //groups loop ?>

    <div id="widget1">

    (stuff from group 9)

    (stuff from group 7)

    </div>

    <?php endif; endwhile; ?>
    <?php endif; ?>

    After experimenting, I couldn’t make it work.

    I need that because in my design I’d like to output a “Personal stuff” widget that has a graphic title and background, and it should display only if some fields from groups 9 and 7 are filles in, otherwise it should’t.

    Is that achievable?

    That is a guru question, isn’t it?

Viewing 25 results - 476 through 500 (of 564 total)
Skip to toolbar