Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 23 replies - 1 through 23 (of 23 total)
  • @antipole

    Participant

    No resolution I have heard of. It would be complicated.

    I have adopted a work-around. which is to allow login by email address only. That way, leaking the user name is no longer a security risk.

    My code here

    @antipole

    Participant

    I second action here.

    WP now has a password strength indicator with an option to allow a weak password. There is a plugin here that removes that option, so a user setting their password in the backend cannot set one WP regards as weak.

    Bu there is nothing to stop a use setting a very weak password in their BuddyPress profile. It warns you it is weak but still allows it. Please can we have the ability to block that?

    @antipole

    Participant

    @leog371 – thanks for trying to help. That did not do it, however. I am copying below the html presently generated in the hope this might help.
    My issue is that the two user names in the list of recent members (John – Paris & Mile Peregrine) are linked to their profiles, but the links only colour when hovering over the links. I need them to be coloured all the time, as my site uses the colouring as visual clue that it is clickable.

    The colour required is: color: #05a9c5;

    thanks

    <aside id="bp_core_members_widget-4" class="widget widget_bp_core_members_widget buddypress widget"><h3 class="widget-title"><a href="http://testsite.xxx.org.uk/members/">Welcome to our new members</a></h3>
    		
    			<div class="item-options" id="members-list-options">
    				<a href="http://testsite.xxx.org.uk/members/" id="newest-members" class="selected">Newest</a>
    				<span class="bp-separator" role="separator">|</span>
    				<a href="http://testsite.xxx.org.uk/members/" id="recently-active-members" >Active</a>
    
    				
    			</div>
    
    			<ul id="members-list" class="item-list" aria-live="polite" aria-relevant="all" aria-atomic="true">
    
    				
    					<li class="vcard">
    						<div class="item-avatar">
    							<a href="http://testsite.xxx.org.uk/members/paris/" class="bp-tooltip" data-bp-tooltip="John - Paris"><img src="//www.gravatar.com/avatar/69299ce42f215930a2181c49f1eb4bef?s=50&r=g&d=mm" class="avatar user-119-avatar avatar-50 photo" width="50" height="50" alt="Profile picture of John - Paris" /></a>
    						</div>
    
    						<div class="item">
    							<div class="item-title fn"><a href="http://testsite.xxx.org.uk/members/paris/">John - Paris</a></div>
    							<div class="item-meta">
    																	<span class="activity" data-livestamp="2017-12-17T23:51:09+0000">registered 1 week, 3 days ago</span>
    															</div>
    						</div>
    					</li>
    
    				
    					<li class="vcard">
    						<div class="item-avatar">
    							<a href="http://testsite.xxx.org.uk/members/peregrin/" class="bp-tooltip" data-bp-tooltip="Mike - Peregrine"><img src="//www.gravatar.com/avatar/0e516af4e69f0befa893934cbd29d023?s=50&r=g&d=mm" class="avatar user-118-avatar avatar-50 photo" width="50" height="50" alt="Profile picture of Mike - Peregrine" /></a>
    						</div>
    
    						<div class="item">
    							<div class="item-title fn"><a href="http://testsite.xxx.org.uk/members/peregrin/">Mike - Peregrine</a></div>
    							<div class="item-meta">
    																	<span class="activity" data-livestamp="2017-12-02T18:55:20+0000">registered 3 weeks, 4 days ago</span>
    															</div>
    						</div>
    					</li>
    
    				
    			</ul>
    
    			<input type="hidden" id="_wpnonce-members" name="_wpnonce-members" value="ab1b45abd0" />
    			<input type="hidden" name="members_widget_max" id="members_widget_max" value="2" />
    </aside>
    

    @antipole

    Participant

    Thank you very much both for your help. After a lot of fiddling about I found the following worked for me:

    /* make links in widgets visible */
    .widget ul li a {
       color: #05a9c5 ;
    }

    This did the trick… but I had to fiddle with the .css loading priorities to get it to actually work. In my child theme’s functions.php file I had to set a priority for the child-style enqueueing, viz.

    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    function theme_enqueue_styles() {
        wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
        wp_enqueue_style( 'child-style',
            get_stylesheet_directory_uri() . '/style.css',
            array('parent-style'),10
        );
    }

    @antipole

    Participant

    mmm.. no luck – but thank you very much for trying.

    I have temporarily made the widget visible to non-logged in users. My test site is here.

    The links are those to members displayed in the “Welcome to our new members’ widget bottom right.

    @antipole

    Participant

    @leog371 – thanks for trying to help. Unfortunately that does not work.
    Herewith the html being generated. I need the user names (John – Paris etc.) to be coloured as a visual hint. At present it only colours when you hover over it.

    thanks

    
    <ul id="members-list" class="item-list" aria-live="polite" aria-relevant="all" aria-atomic="true">
    
    				
    					<li class="vcard">
    						<div class="item-avatar">
    							<a href="http://testsite.ovni-owners.org.uk/members/paris/" class="bp-tooltip" data-bp-tooltip="John - Paris"><img src="//www.gravatar.com/avatar/69299ce42f215930a2181c49f1eb4bef?s=50&r=g&d=mm" class="avatar user-119-avatar avatar-50 photo" width="50" height="50" alt="Profile picture of John - Paris"></a>
    						</div>
    
    						<div class="item">
    							<div class="item-title fn"><a href="http://testsite.ovni-owners.org.uk/members/paris/">John - Paris</a></div>
    							<div class="item-meta">
    																	<span class="activity" data-livestamp="2017-12-17T23:51:09+0000">registered 1 week, 3 days ago</span>
    															</div>
    						</div>
    					</li>
    
    				
    					<li class="vcard">
    						<div class="item-avatar">
    							<a href="http://testsite.ovni-owners.org.uk/members/peregrin/" class="bp-tooltip" data-bp-tooltip="Mike - Peregrine"><img src="//www.gravatar.com/avatar/0e516af4e69f0befa893934cbd29d023?s=50&r=g&d=mm" class="avatar user-118-avatar avatar-50 photo" width="50" height="50" alt="Profile picture of Mike - Peregrine"></a>
    						</div>
    
    						<div class="item">
    							<div class="item-title fn"><a href="http://testsite.ovni-owners.org.uk/members/peregrin/">Mike - Peregrine</a></div>
    							<div class="item-meta">
    																	<span class="activity" data-livestamp="2017-12-02T18:55:20+0000">registered 3 weeks, 4 days ago</span>
    															</div>
    						</div>
    					</li>
    
    				
    			</ul>
    

    @antipole

    Participant

    @joeaj111 – not sure I understand your question… it is standard BuddyPress stuff:

    1. Create a blank page for the members list
    2. Set that page as the Members page in BuddyPress settings

    When you display that page you see a list of members and at the top is a search box to search for a member.

    @antipole

    Participant

    I am now using the plugin Dynamic Widgets to hide the login widget on the register page.

    This is not as good as hiding the sidebar, but does avoid the problem.

    @antipole

    Participant

    I have solved this problem by filtering the relevant data and processing it with the following, which deals with the escaped sequences I was seeing.

    function ovni_decode_escapes($string){
    	// various characters will be escaped - decode them back
    	$string = html_entity_decode($string, ENT_QUOTES);  // deal with escaped quotes
    	$string = str_replace('–', '–', $string);  // and the pesky dash
    	return $string;
    	}

    @antipole

    Participant

    Thank you very much @danbp. This does exactly what I wanted.

    Only ‘problem’ is that I don’t understand how it works. You are setting $field to be the required field definition. Then you set what appears to be the local variable $enabled to false, but don’t reference it any further or return it.

    Or is there more to ‘$enabled’ than I am seeing?

    Pardon my ignorance.

    @antipole

    Participant

    Sure – it could go in your bp-custom.php file.

    @antipole

    Participant

    I now think this issue is because, although the widget is titled Latest Activity it is actually displaying recent topics and/or replies, which it finds by retrieving those posts and not the activity stream.

    @antipole

    Participant

    @henrywright… not sure exactly what you are doing, but you should be able to only generate the label when there is data

    if ($field_content){
          return "label: " . $field_content;
          }
    else return();
    

    @antipole

    Participant

    Thank you to all who have helped and especially @danbp who took time to explain things at length.
    I have finally grasped how this thing works, more or less.

    I do need to apply the same quite complex filter to both the profile and directory list. I have now devised a common filter function plugin that can be invoked within the members loop as a filter and within the profile display as an action. I have to call it in different ways, depending on where it is being called from, and the trick was to call it from two separate hookable functions. The core of what I have follows:

    
    // Remove standard filtering of profile fields
    function ovni_init() {
    	remove_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 9, 2 );
    	}
    add_action( 'bp_init', 'ovni_init' );
    
    // add our replacement filter, which is given a field value, to the members loop
    function ovni_filter_field_for_directory($field_value){
    	$field_name=bp_get_the_profile_field_name();
    	return ovni_get_field_searchable($field_name);
    	}
    add_filter( 'bp_get_the_profile_field_value', 'ovni_filter_field_for_directory', 50, 1 );
    
    // add fields to directory listing make them searchable according to rules of this plugin
    function ovni_add_info_to_members_loop() {
    	echo '<div style="position: absolute; left:60px;">', ovni_get_field_searchable('Ovni model'),'</div>';
    	echo '<div style="position: absolute; left:100px;">', ovni_get_field_searchable('Rig'),'</div>';
    	echo '<div style="position: absolute; left:275px;">', ovni_get_field_searchable('Home waters'),'</div>';
    	echo '<div style="position: absolute; left:500px;">', ovni_get_field_searchable('Home port'),'</div>';
    
    }
    add_action( 'bp_directory_members_item', 'ovni_add_info_to_members_loop' );
    
    // the fuction that makes fields searchable according to the rules of this plugin
    function ovni_get_field_searchable($field_name) {	
    	global $ovni_no_link_fields, $ovni_social_networking_fields;
    	$field_value = xprofile_get_field_data($field_name, bp_get_member_user_id() );
    	
    	if ( $field_value) { // only if there is content in the field
    		if (is_array($field_value)){
    etc. etc.

    I have not included the code of my filter, but it is changing the way text in profile fields are turned into links, both when displayed in the directory entry and in the members list, thus:

    (1) If is an array, serialise into a comma-separated string
    (as used in outputing which social web sites a mobile number can be used for)
    (2) If is an image, change HTML so that clicking on image will open full size in new tab/window
    (3) If any field contians text in [ ], the contents of the [ ] pairs are turned into separate directory searches.
    So if the entire text is in [ ] it overrides all other rules
    (4) Fields in the list of ‘do not link’ fields are left plain
    (5) The user’s web site is converted to its URL
    (6) Fields containing social network user names are turned into links to those networks
    (7) The remaining are turned into links to search the directory for matches.

    It has been a learning curve. My formative programming of this type was in the language B (the antecedent of C), which shows how far back I go!

    thanks again for the help, Tony

    @antipole

    Participant

    @danbo… thank you for responding. I am struggling – I am not an expert in this and I am unsure what is called by what, and whether the filter you suggest will be invoked by what I had already. I now have your suggestion included:

    function add_info_to_members_loop() {
    	echo '<div style="position: absolute; left:60px;">', bp_get_member_profile_data('field=Ovni model'),'</div>';
    	echo '<div style="position: absolute; left:100px;">', bp_get_member_profile_data('field=Rig'),'</div>';
    }
    add_action( 'bp_directory_members_item', 'add_info_to_members_loop' );
    
    function make_directory_profile_field_searchable() {	
    	if ( $value = xprofile_get_field_data('Ovni model', bp_get_member_user_id() ) ) :
    	   // as of xprofile_filter_link_profile_data function
     	  $search_url = add_query_arg( array( 's' => urlencode( $value ) ), bp_get_members_directory_permalink() );
    	   $clickable = '<div class="click_dir"><a href="' . esc_url( $search_url ) . '" rel="nofollow">' . $value . '</a></div>';	
    	   echo $clickable;	
    	   endif;
    }
    add_filter ( 'bp_directory_members_item', 'make_directory_profile_field_searchable' ); 	 

    Your code has the field name ‘Ovni model’ built in and I don’t understand how to pass the field name through from add_info_to_members_loop.

    [I still think that if I could work out what is called when a field is displayed in the user profile, that call would deliver what I need in the members loop.]

    I have spent a long while trying to fathom this out, so extra help will be really appreciated.

    @antipole

    Participant

    So I am getting my extra user data fields with a line like:
    echo '<div style="position: absolute; left:150px;">' , bp_get_member_profile_data('field=Ovni model'),'</div>';
    But I would like them to be search links as it is in an individual profile. I have achieved this with

    echo '<div style="position: absolute; left:60px;"><a href=', $bp->pages->members, '?s=', bp_get_member_profile_data('field=Ovni model'),' rel="nofollow">' , bp_get_member_profile_data('field=Ovni model'),'</a></div>';
    

    However, I am now also using the plugin Custom Profile Filters for BuddyPress, which lets me set which profile fields should not be search links and also allows users to spilt their data up, so a profile field “[ocean] and [coast]” gets two separate search links, one for ‘ocean’ and another for ‘coast’. Neat. It seems to do this by adding a filter to bp_get_the_profile_field_value.

    However, my manual addition of search links as above ignores these settings, and any [] in the fields comes through and are visible.

    It occurs to me that, rather than fetching the fields with bp_get_member_profile_data(), I would do better to get the data however it is got for the individual profile display, as this method puts the search links in and obeys the options set in Custom Profile Filters for BuddyPress. I have spent much of today trying to find how to call bp_get_the_profile_field_value. If I use
    echo '<div style="position: absolute; left:150px;">' , bp_get_member_profile_value('field=Ovni model'),'</div>';
    I get an invalid link. I suspect it need a data type argument to get a search link. I have tried to find how it is called to display the user profile, but failed to find it. In the BP Codex I have only found how to remove the filter that puts the links in.

    If someone could enlighten me it would be most helpful. Thanks.

    @antipole

    Participant

    Thank you, thank you for your clear and authoritative reply.

    I adopted method (2) as it seemed easier for me and I now have the result I wanted.

    Very happy!
    Tony

    @antipole

    Participant

    I have a solution to this – I have written a minimal plugin that diverts to a ‘denied’ page if a non-logged-in user tries to access the private type of information. I still allow the profile to be displayed as that has its own permissions arrangements. Here is my plugin:

    <?php
    /*
    Plugin Name: Make certain pages private
    Description: Specifically for ******** website: prevents not-logged-on users from seeing certain pages otherwise visible
    Version:     1.0
    Author:      Tony *****
    */
    
    function check_for_private_pages()
    {
    	if (is_user_logged_in() == true){
    	/* nothing to do if logged in */
    	return;
    	}
    	else {
    	if (bp_is_activity_component() || bp_is_forums_component() || bp_is_blogs_component() || bp_is_groups_component()){
    	header('Location: http://'. $_SERVER["HTTP_HOST"] . '/oops-cant-get-you-where-you-tried-to-go/');
    	}
    	}	
    }
    
    add_action('template_redirect', 'check_for_private_pages');
    
    ?>
    

    @antipole

    Participant

    OK – in the absence of anyone enlightening me, I set up a test site with just WP, BuddyPress and bbPress, together with the plugin ’email log’. I determined that emails are not sent by bbPress.

    I have now installed BuddyPress Forum Notifier, which seems to do the job.

    I am presently experimenting with cron to ensure the batching of comments works reliably.

    @antipole

    Participant

    PS and I have switched to theme 2013.

    @antipole

    Participant

    I have a solution for this – although not particularly neat.

    I took a copy of the BuddyPress Core Component Widgets and changed all occurrences of bp_core_register_widgets to, in my case, bp_ovni_core_register_widgets, and placed it in the bp-custom.php file. This gave me a new widget that I could place in the side bar instead of the standard (BuddyPress) Log In. This change seems necessary to avoid a re-registration error.

    I then edited the action after <?php if ( bp_get_signup_allowed() ) : ?> to go to my information page instead of the register page. From that page I link to my actual registration page, where the register form is displayed.

    It all seems to work for me.

    @antipole

    Participant

    @henrywright… thinking about it further, I think my best approach would be to modify the (BuddyPress) Log in: Log in/out widget so that when a non-logged in user selected Register it linked to my own page. This would leave the real Register page unaffected and available for me to include as a link on my information page.

    I have now found the widget code in the bp-core-widgets.php file. I took a copy into the bp-custom.php file, but I get the error message Fatal error: Cannot redeclare class BP_Core_Login_Widget.

    I assume this original code is not checking if it has already been loaded. Not sure how I can modify this in a way that does not get lost on a BuddyPress update.

    Can I trouble SKS for further guidance? thanks

    @antipole

    Participant

    @henrywright – thank you for responding

    I set up a bp-custom.php file and am able to redirect as you suggest.

    The condition I am using is
    if ( bp_is_register_page()) {

    This works in that any attempt to land on the register page gets redirected to my own pre-registration information page. But when I follow my ‘go ahead and register’ link, I get redirected back to my pre-registration information page. Since the re-direction happens as the registration page is about to load, I do not see how to get to registration when I need to.

    I really need to divert the BP register links without stopping me going direct to the register page when the user is ready.

    Any further advice would be much appreciated.

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