Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

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

  • dzung
    Participant

    @bluesharp

    Luckily I found it from a thread:
    Here’s in the plugin in buddypress-xprofiles-acl
    Comment the below function!

    /* function filter_xprofile_groups_with_acl() {
        global $bp, $profile_template, $current_user;
        get_currentuserinfo();
        foreach($profile_template->groups as $key => $profile_group) {
          if( ! in_array($profile_group->id, $this->user_allowed_xprofile_groups) ) {
            unset($profile_template->groups[$key]);
          }
        }
      }
      */

    dzung
    Participant

    @bluesharp

    I still get this issue, now only User can see his xProfile – Even Admin can’t see other user xProfile. I have tried to switched to the Twenty Theme, but it still happens.

    I have traced to here:

    //I have two profile Groups, the Base group and one more I created.
    // I created a User with full profile fields data.

    <?php while ( bp_profile_groups() ) : bp_the_profile_group(); ?>
    <?php if ( bp_profile_group_has_fields() ) : ?>

    If the user view his own profile the bp_profile_group_has_fields() will return True two times. But if another user view this user profile it will only return True 1 time and the 2nd time is false – that makes it display only Base group profile Fields and xProfile fields can’t display.

    I use WP 3.9 Latest BuddyPress and installed a lot of plugins.


    dzung
    Participant

    @bluesharp

    I first tested my function like this:

    function custom_bp_profile_group_tabs() {
    echo ‘bacon’;
    }
    add_filter(‘xprofile_filter_profile_group_tabs’,’custom_bp_profile_group_tabs’);

    It worked and returned “bacon” in the area of “Base” and “GroupProfile” menu.

    So if echo is not a return then, I think the Filter doesn’t require return!


    dzung
    Participant

    @bluesharp

    In the original function, there’s no return statement only echo. So I think echo $tab; is the return you mentioned!

    tab_names = array(‘Base’, ‘GroupProfile’ ); // add to as necessary

    The Profile Group name is not fixed and Admin can rename/or add more Profile Groups, so I think shouldn’t use hard-coded like above!


    dzung
    Participant

    @bluesharp

    Thanks for your guide – I wrote my code and it works. Can you please have a look to see if it’s okay to do like that?

    PS: I don’t know why If I copy all the function content then I can’t submit this reply it says “ERROR: Your reply cannot be created at this time. ” So I have to remove some line in the function and it ok!

    function custom_bp_profile_group_tabs() {
    ...same content with the original function ....
    $tabs[] = sprintf( '<li %1$s><a href="%2$s">Edit %3$s</a></li>', $selected, $link, esc_html( $groups[$i]->name ) );
    		}
    	}
    	//$tabs = apply_filters( 'xprofile_filter_profile_group_tabs', $tabs, $groups, $group_name );
    	foreach ( (array) $tabs as $tab )
    		echo $tab;
    
    	do_action( 'xprofile_profile_group_tabs' );
    }
    add_filter('xprofile_filter_profile_group_tabs','custom_bp_profile_group_tabs');

    dzung
    Participant

    @bluesharp

    Has anyone figured out how to do this, I need the same thing:

    I have a drop down list of schools with the ‘Other’ option as so user can enter a school name.

    I need this in urgent! hope someone will help!


    dzung
    Participant

    @bluesharp

    @aces I just check it apache log error files, there’s nothing there.


    dzung
    Participant

    @bluesharp

    @mercime – I just fix the issue with notification tab – and that seems to has effect on this too.

    Now logged in members can see other members full profile fields. I want to make the full profile fields including base fields and xProfile group fields public to everyone even not logged in, how can I do this?


    dzung
    Participant

    @bluesharp

    To anyone who want the same thing, follow my below steps.

    I have a text file contains about 600+ names of schools and I want to make a schools-drop-down – So It’s very time-consuming to click add option one by one. It needs another way:

    1. Content of The Schools list text file.
    Tamale Polytechnic
    Kumasi Polytechnic
    Accra Polytechnic
    Cape Coast Polytechnic
    Koforidua Polytechnic
    Ho Polytechnic
    ….600+…
    2. I go to xProfile and create a Drop-down named it Schools – I input one option say “A sample school” – save.
    3. I go to phpMyadmin -to Database to table gsl_bp_xprofile_fields – Search “A sample school” to find the newly created Sample schools row – on the result look at the
    columns: (group_id, parent_id, type , name) . they should have values like: (group_id: 1, parent_id: 127,type :’option’ ,name :’A sample school’).
    4. Next I use a Core Java code(because I don’t know how to do this in PHP) to read the schools list text file one by one and custom the print out like this:

    
    String fileName = "D://Schools.txt";
    String line = null;
    try {
      FileReader fileReader = new FileReader(fileName);
      BufferedReader bufferedReader = new BufferedReader(fileReader);
      while((line = bufferedReader.readLine()) != null) {
        line = line.replace("'", "");
        String sqlBase = "INSERT INTO gsl_bp_xprofile_fields (group_id,parent_id, type,name) VALUES (1, 127,'option' ,"+"'"+line+"'"+");";
        System.out.println(sqlBase);
                }	
        bufferedReader.close();			
    }

    After running the above code I have a list of SQL insert commands printed on my eclipse they look like this:

    INSERT INTO gsl_bp_xprofile_fields (group_id,parent_id, type,name) VALUES (1, 127,'option' ,'Tamale Polytechnic');
    INSERT INTO gsl_bp_xprofile_fields (group_id,parent_id, type,name) VALUES (1, 127,'option' ,'Kumasi Polytechnic');
    INSERT INTO gsl_bp_xprofile_fields (group_id,parent_id, type,name) VALUES (1, 127,'option' ,'Accra Polytechnic');

    ….many more insert commands until the end of the schools file 600+

    5. Next, I copy all these commands, come back phpMyadmin database- table gsl_bp_xprofile_fields – to SQL tab, paste all commands, click run/go to insert all the options.

    That’s all done for me!


    dzung
    Participant

    @bluesharp

    @adeolu , Below is the html tag of View/Edit and Change Avatar Tab.

    <ul>
      <li class="current selected" id="public-personal-li"><a href="http://mysite../members/student/profile/" id="public">View</a></li>
      <li id="edit-personal-li"><a href="http://mysite../members/student/profile/edit/" id="edit">Edit</a></li>
      <li id="change-avatar-personal-li"><a href="http://mysite../members/student/profile/change-avatar/" id="change-avatar">Change Avatar</a></li>
    </ul>

    Using Chrome Inspect element, i saw in my theme CSS file: there’s a css like this:
    #change-avatar-personal-li{
    display:none;
    }

    I changed it to:
    #change-avatar-personal-li{
    display:block;
    }

    And it works.


    dzung
    Participant

    @bluesharp

    @mercime Yes, it was an issue with the theme. I don’t know why they use css to hide it. I just remove that css and I have the change avatar button now. Thanks a lot.


    dzung
    Participant

    @bluesharp

    For now, I’ve come to another solution, where I allow users to Register new account with base Fields and a Role selection (Student or Lecturer in my case). They then fill in only base field and then after account creation they can update their Student or Lecture xProfile Group Fields in their profile page edit.

    I do these above by using 3 plugins:

    1. https://wordpress.org/plugins/wpfront-user-role-editor/
    This will allow me to add new Role: Student and Lecturer in my case (I have tried other Role plugin but they conflict with other plugins on my site, this one doesn’t).

    2. https://wordpress.org/extend/plugins/wp-roles-at-registration/
    This one allow me to add a Drop down for New user to choose their wanted role : Student or Lecturer

    3. https://wordpress.org/extend/plugins/buddypress-xprofiles-acl/
    This plug in allow me to set buddypress xProfile group to a specific user role. In my case, I created two xProfile Group fields named “Student” and “Lecture” each has different fields. Then using this plugin I assigne the xProfile Student to Student Role, and the xProfile Lecturer to Lecturer Role.

    That’s all done!

    Meanwhile I will use this, but I still want to be able to have two sign up forms with different fields so that I can require New user to fill in the Required field to make the profile better. I can’t code much so hope someone will help!


    dzung
    Participant

    @bluesharp

    @piratescott thanks for that link, I followed it and added the code into my theme functions.php file, but when I try the link at mysite/wp-login.php?action=register&role=seller it will auto redirect to the mysite/register page. How did you get this done?


    dzung
    Participant

    @bluesharp

    @mercime Thanks for the link, I’ve checked it. But I think it’s not a wordpress or wamp issue, because I’ve been using these for the last 2 years and built about ten sites without any problem. I have changed the default permalinks setting to Post Name already.


    dzung
    Participant

    @bluesharp

    @mercime Thanks for your reply.

    The site is on my local-host, wampsever and it is a fresh new one without any other plugins.


    dzung
    Participant

    @bluesharp

    I’ve re-installed many times to test and found that if bbPress installed and I try to enable the setting for Component User Groups by checking it. That will make error. I use the Latest versions of wp, buddypress, bbpress and default wp theme.

    This is my 3rd times post so I hope someones will give some info that helps me to fix this.

Viewing 16 replies - 1 through 16 (of 16 total)
Skip to toolbar