Robin W (@robin-w)

Forum Replies Created

Viewing 25 replies - 11,226 through 11,250 (of 14,146 total)
  • @robin-w

    Moderator

    and do let me know if it works !

    @robin-w

    Moderator

    ok, that is buddypress adding the profile fields, so you may need to take it up with them if the next bit doesn’t work !

    However whilst doing something for someone else today, I found a function on the net, which I have amended (but not tested) below

    function change_display_name( $user_id ) {
        $info = get_userdata( $user_id );
    	$args = array(
    		'ID' => $user_id,
    		'display_name' => $info->user_login 	);
        wp_update_user( $args );
    }
    add_action('user_register','change_display_name');
    
    

    then on registration it should set the display_name to the username

    put this in your functions file

    Functions files and child themes – explained !

    @robin-w

    Moderator

    good start, but that approach gets very complicated, as whilst you have added the fields, you have not saved them or said where to save them – that requires a whole bunch of other code !

    Easier approach :

    bbpress uses wordpress registration, so it’s easier to hook to that.

    The whole bunch of code below is not my original work (but I do use it on one of my sites, so know it works) but if you have a play with it, you should be able to adapt it.

    `//add code for adding first and last name to registration

    //1. Add a new form element…
    add_action(‘register_form’,’myplugin_register_form’);
    function myplugin_register_form (){
    $first_name = ( isset( $_POST[‘first_name’] ) ) ? $_POST[‘first_name’]: ”;
    $last_name = ( isset( $_POST[‘last_name’] ) ) ? $_POST[‘last_name’]: ”;
    ?>
    <p>
    <label for=”first_name”><?php _e(‘First Name as people call you eg Dave’,’mydomain’) ?><br />
    <input type=”text” name=”first_name” id=”first_name” class=”input” value=”<?php echo esc_attr(stripslashes($first_name)); ?>” size=”25″ /></label>
    </p>
    <p>
    <label for=”last_name”><?php _e(‘Last Name’,’mydomain’) ?><br />
    <input type=”text” name=”last_name” id=”last_name” class=”input” value=”<?php echo esc_attr(stripslashes($last_name)); ?>” size=”25″ /></label>
    </p>
    <?php
    }

    //2. Add validation. In this case, we make sure first_name and last_name is required.
    add_filter(‘registration_errors’, ‘myplugin_registration_errors’, 10, 3);
    function myplugin_registration_errors ($errors, $sanitized_user_login, $user_email) {

    if ( empty( $_POST[‘first_name’] ) )
    $errors->add( ‘first_name_error’, __(‘ERROR: You must include a first name.’,’mydomain’) );
    if ( empty( $_POST[‘last_name’] ) )
    $errors->add( ‘last_name_error’, __(‘ERROR: You must include a last name.’,’mydomain’) );

    return $errors;
    }

    //3. Finally, save our extra registration user meta.
    add_action(‘user_register’, ‘myplugin_user_register’);
    function myplugin_user_register ($user_id) {
    if ( isset( $_POST[‘first_name’] ) )
    update_user_meta($user_id, ‘first_name’, $_POST[‘first_name’]);
    if ( isset( $_POST[‘last_name’] ) )
    update_user_meta($user_id, ‘last_name’, $_POST[‘last_name’]);
    }

    in essence start by looking at the end – 3. save

    and the line

    update_user_meta($user_id, ‘first_name’, $_POST[‘first_name’]);

    this is updating a user_meta field called ‘first_name’ for the user_id $user_id with the information entered in $_POST[‘first_name’]

    So it is saving the first name the user enters in a user_meta field for that user called ‘first_name’

    My plugin stores the data in a user_meta field called ‘rpi_label1’, so a find/replace to change ‘first_name’ to ‘rpi_label1’ is what is needed throughout the code. then some tidying up of things like the prompts and you should have it working.

    Give it a go, and see how you get on. IF you get it working, the deal is you post the result back here, and I can nick it for the plugin (and give you a credit) !

    If you don’t then come back with how you are getting on, and I’ll help – too tied up to do all the work myself !

    This code by the way goes in your functions file see

    Functions files and child themes – explained !

    @robin-w

    Moderator

    @robin-w

    Moderator

    Perhaps we decide that it would be great to have this feature for our platform and hire someone.

    Contact

    Contact me

    @robin-w

    Moderator
    In reply to: Whitelisting users?

    @robin-w

    Moderator

    @douglsmith – hey thanks for that, and if you get it working, let us know !

    @robin-w

    Moderator

    Thought you said you hated code?!! 🙂

    Have you a specific registration template in mind, does your theme come with something?

    @robin-w

    Moderator

    hmm…. bbpress plays well with wordpress, so that should not happen.

    Usually a 500 error in wordpress a coding issue.

    Do you only get the 500mn errors when you btry and do something wordpressy?

    and when you get a 500 error, click the refresh on your browser, and usually it comes up with the specific error that is occurring – come back with that.

    @robin-w

    Moderator

    ok, so

    create a directory on your theme called ‘bbpress’
    ie wp-content/themes/%your-theme-name%/bbpress

    where %your-theme-name% is the name of your theme

    find
    wp-content/plugins/bbpress/templates/default/bbpress/user-details.php
    Make a copy of this file, and put in in the directory called bbpress that you created above, so you end up with
    wp-content/themes/%your-theme-name%/bbpress/user-details.php

    bbPress will now use this template instead of the original

    Now edit that file so that you add a new line between line 16 & 17 which currently read

    <div id="bbp-single-user-details">
    <div id="bbp-user-avatar">
    
    

    so add

    <h1>  <?php bbp_displayed_user_field( 'display_name' ); ?> </h1>
    
    

    after this line so that you end up with

    <div id="bbp-single-user-details">
    	<h1>  <?php bbp_displayed_user_field( 'display_name' ); ?> </h1>
    	<div id="bbp-user-avatar">
    

    as the three lines.

    and save

    It should now display

    @robin-w

    Moderator

    A quick code to achieve such will be much appreciated.

    If it was I’d give it, but it would involve a rewrite of the function bbp_reply_author_link

    It’s quite do-able, but I don’t have the time – sorry !

    @robin-w

    Moderator

    Fatal error: Call to undefined function wpb_remove() in /home/f14life/public_html/wp-content/themes/effektive/functions.php on line 59

    can you tell us what is on that line please, and give us a few lines before and after

    @robin-w

    Moderator

    Emails not working can be caused by many factors. Try working through the following :
    1. Spam filters
    You should be aware that many spam filters strip messages that do not come from the correct address. So if your site is mysite.com and your email address in wordpress settings>general is fred@gmail.com then it is likely that messages will be dumped in transit. You need to set up email to come from your site eg fred@mysite.com, your hosting provider can help if needed.
    2. Just bbpress?
    Then you need to see if this is wordpress wide or just bbpress.
    Try https://wordpress.org/plugins/check-email/

    then come back

    In reply to: Log In Problems

    @robin-w

    Moderator

    In order to test, I have created a new user (in users) but when I log out, and try to log in the new details it comes up with the wordpress admin panel saying wrong details.

    Can you give the exact error please

    In reply to: Whitelisting users?

    @robin-w

    Moderator

    presume you are using askimet as your spam filter, in which case 3 links and it’s pending !

    @robin-w

    Moderator

    ok, I googled and couldn’t find a theme called aqyp, so not sure where you got it from

    @robin-w

    Moderator

    ok, but when you do try it, if it doesn’t work come back – I have a plan B !

    In reply to: Oh Brother…

    @robin-w

    Moderator

    ok, so do you need help to correct the bbpress.php, or are you happy without it?

    @robin-w

    Moderator

    3. Completely hide any backend/admin type stuff from non-admin users so that they never leave the frontend part of the site

    I agree – I hate that part as well

    use

    https://wordpress.org/plugins/hide-admin-bar-from-non-admins/

    @robin-w

    Moderator

    2. Add a link to the bbPress Login Widget for users to edit their profiles (instead of clicking their names…clicking their names doesn’t seem obvious to me)

    Can’t d0 that without coding, but my plugin
    https://wordpress.org/plugins/bbp-style-pack/

    will let you add this (and optionally register and login/logout) to the menu bar

    Install and then

    go into Dashboard>settings>bbp style pack>login and take a look

    @robin-w

    Moderator

    ok, it hasn’t come through, so first of three replies to avoid the spam filter !

    WITHOUT CODE – I can do more if you accept coding!

    1. Alter the bbPress user profile page–adding new fields, editing existing fields and removing fields

    Try my plugin https://wordpress.org/plugins/bbp-profile-information/

    Lets you add 4 profile fields for users to update and you can optionally display these under the avatar on topics and replies.

    If you want to remove fields – that’s code, but let me know which ones you want to remove, and I’ll take a look.

    @robin-w

    Moderator

    ok

    @robin-w

    Moderator

    I’m in UK!

    ok, two things we can do

    try this first

    Deactivate bbpress tweaks
    Dashboard>plugins>bbpress tweaks>deactivate

    Go into widgets
    Dashboard>appearance>widgets

    And look at the bottom of the left hand side. You’ll see an “inactive sidebar”, with your entries on
    Below this is an “inactive widgets”
    Drag all the entries from the inactive sidebar to the inactive widgets area.
    This then allows wordpress to delete the sidebar
    I normally log out and in again at this stage – probably not needed, but I’ve never bothered to check
    Then basically reverse the above
    Re-enable bbpress tweaks
    You see the bbpress sidebar returns
    Drag the entries back from the inactive widgets area to the sidebar

    @robin-w

    Moderator

    ok, so you have a sidebar, just not the right one – yes?

    @robin-w

    Moderator

    I had an idea, but having done a bit of research, it would be too much coding so at the moment the answer is no, sorry not possible.

Viewing 25 replies - 11,226 through 11,250 (of 14,146 total)