Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

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

  • ekko848
    Participant

    @ekko848

    Thank you. wp_usermeta was what I was looking for.


    ekko848
    Participant

    @ekko848

    I see I see. Well thank you again for the assistance.
    I think we can mark this one resolved.


    ekko848
    Participant

    @ekko848

    Well, I was able to do this by using the MySQL field html edit.. and for whatever reason it wasn’t including the rel=”tooltip” even though it was in the field.

    Anyways, I looked up the CSS unique selector for my Twitter Handle field and then added the following to my profile.php

    <script>
    $(".field_41 > td.label > abbr").attr('rel', 'tooltip');
    </script>

    And now it’s working properly.

    This seems like a weird way to do it, but I don’t know. I kind of figured there would be an easy way to change the HTML on a static profile field label, especially considering there is a method (as danbp described) to change html in data field.


    ekko848
    Participant

    @ekko848

    Yes, danbp. I was messing around with code like that, but this function sets the $field_value to the DATA, not the label.

    Here’s what I mean:

    With your code–

    And on hover…

    Works well, except that it’s in data field not the profile label field.

    Here is what was happening when I was modifying HTML contents of profile field in MySQL-

    Works properly– but for some reason it’s taking out the rel="tooltip" as I mentioned in the third reply down, so is not applying tooltip style.

    We are wanting the tooltip on the Profile Label (that says ‘Twitter Handle’), and not the data, because by default, of course, the data will be empty and nothing will display. If a user hovers over Twitter Handle they will see the tooltip and know how to enter profile field properly beforehand.

    Hope that explains it.


    ekko848
    Participant

    @ekko848

    Umm.. actually, I don’t think this is the best strategy to accomplish this.
    It seems modifying the varchar contents of Profile Label doesn’t accept HTML that well.

    Close, but it seems to cut things out…

    <abbr title="Twitter handle without the @ sign" rel="tooltip" style="border-bottom:1px dotted;text-decoration:none;color:#00F303;display:inline-block;height:1.18em;">Twitter Handle</abbr>

    <abbr title="Twitter handle without the @ sign">Twitter Handle</abbr>

    So it cuts out the rel=”tooltip” which is the function that activates the style. So there must be a better way, or a workaround…


    ekko848
    Participant

    @ekko848

    Anyone know if it’s safe to directly edit MySQL Database table to accomplish this?


    ekko848
    Participant

    @ekko848

    Well, I was able to do this by going into wp_bp_xprofile_fields in phpmyadmin, finding my Profile Field Label… and changing the value to include the HTML.

    Also it seems, for some, since there is a 150 character limit, I may have to increase the character limit size to meet my html length.

    Thing is, I’m not sure if this is the best way to do something like this?
    Editing straight from the database seems a little iffy, I don’t want to potentially break anything.

    Any comments? Re-assurance?


    ekko848
    Participant

    @ekko848

    So, taking it off localhost and onto my live site fixed the broken image problem.

    But, I am still confused as to why BP_AVATAR_DEFAULT is not working at all?


    ekko848
    Participant

    @ekko848

    Cheers mate. Wasn’t looking for the obvious, apparently.


    ekko848
    Participant

    @ekko848

    Ended up inserting random data into ‘Update Field’ on activation, and now code works to ‘overwrite’ that data and insert html again.

    I think the reason before was because ‘Update Field’ had no data so profile was not registering it as a field to display.


    ekko848
    Participant

    @ekko848

    Note I am still on buddypress 2.5.2 (the same version I was on a few weeks ago when this was working).. maybe I should try to update and see if that fixes the issue?

    Or can my function to insert the custom HTML in every users field be optimized or targeted better with some different code?


    ekko848
    Participant

    @ekko848

    Thanks for the reply.

    I will try this.

    One question, though, what do you mean “do via a template”?

    Do you mean like in my php file…

    xprofile_set_field_data( $field_id38, $user_id, '<form id="frm" method="post"  action="?update_post" >
    <input type="submit" value="Update Artist Page" id="submit" class="update-page" />
    </form>');

    or are you referring to some other template?


    ekko848
    Participant

    @ekko848

    Well, HTML is working on this profile field..

    Meaning, I can use the editor to bold stuff, or whatever.

    But as for input buttons like I’m wanting… I can input the code

    Update

    But as soon as I try to ‘Save Changes’ with the code in place it disappears.


    ekko848
    Participant

    @ekko848

    This seems to have worked

    function profile_stream ( $user_id ) {
        $streamid = xprofile_get_field_data( 10, $user_id );
        if (! bp_current_user_can( 'bp_moderate' ) && !empty($streamid)) {
            xprofile_set_field_data( 11, $user_id, "Pending");
        } if (! bp_current_user_can( 'bp_moderate' ) && empty($streamid)) {
            xprofile_set_field_data( 11, $user_id, "");
        }
    }
    
    add_action( 'xprofile_updated_profile', 'profile_stream');

    Considering I am relatively new to PHP and buddypress.. I am surprised I am able to get this stuff to work on my own lol.


    ekko848
    Participant

    @ekko848

    Here is my updated code

    function profile_stream ( $user_id ) {
        $streamid = xprofile_get_field_data( 10, $user_id );
        if (!empty($streamid)) {
            xprofile_set_field_data( 11, $user_id, "Pending");
        } if (empty($streamid)) {
            xprofile_set_field_data( 11, $user_id, "");
        }
    }
    
    add_action( 'xprofile_updated_profile', 'profile_stream');

    If field 10 is not empty, add the words “Pending” to field 11
    If field 10 is empty, make field 11 blank.

    Works perfectly.

    Anyone have any idea on how to restrict this function to normal users though? So it does not apply to an admin/moderator who can change “Pending” to whatever they want


    ekko848
    Participant

    @ekko848

    Thanks for the reply @danbp.

    Actually, I did some more testing.. and it appears my code is working correctly.

    I just forgot the

    add_action( 'xprofile_updated_profile', 'profile_stream');

    beneath it.

    Now if <field 10> has input, then <field 11> is automatically set to Pending.

    My issue now is that I cannot change it to anything other than pending! Cannot change it to “approved” or “rejected” because the code is making it always set to “Pending” whenever the profile is updated and that field is not empty..


    ekko848
    Participant

    @ekko848

    I was googling this and came to this thread. Ended taking some hints from it and edited my compose.php to look like this:

     <?php if ( bp_current_user_can( 'bp_moderate' ) ) : ?>
        <label for="send-to-input"><?php _e("Send To (Username or Friend's Name)", 'buddypress' ); ?></label>
    	<ul class="first acfb-holder">
    		<li>
    			<?php bp_message_get_recipient_tabs(); ?>
    			<input type="text" name="send-to-input" class="send-to-input" id="send-to-input" />
    		</li>
    	</ul>
        <?php else : ?>
        <label for="send-to-input"><?php _e("SEND MESSAGE TO ADMIN", 'buddypress' ); ?></label>
    	<ul class="first acfb-holder">
    		<li>
    			<?php bp_message_get_recipient_tabs(); ?>
    			<input type="hidden" name="send-to-input" class="send-to-input" id="send-to-input" value="admin"/>
    		</li>
    	</ul>
    	<?php endif; ?>

    Just did some initial testing and it seems to work properly..


    ekko848
    Participant

    @ekko848

    Not sure if this is the best way to do this (still figuring out BuddyPress functions), but I added this code to my profile.php and it works for logged in users only

        <?php
    if ( bp_is_my_profile() ) 
        {  echo 'Hello';
    }
    ?>

    ekko848
    Participant

    @ekko848

    This code also crashed my site when trying to add to functions.php


    ekko848
    Participant

    @ekko848

    hmm.. would this be ‘member-header.php’?

    I tried making changes to this a while ago but could not see any changes to the profile?

    For example, I added:

    <div>test</div>

    But cannot see the word ‘test’ anywhere on the logged-in users profile?

    I completely removed the activity stream, so I kind of assumed they were connected.. but this is probably not be the case?

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