Skip to:
Content
Pages
Categories
Search
Top
Bottom

Code cleanup and what about blank xprofile data? (Need dynamic link to profile)


  • LPH2005
    Participant

    @lph2005

    Just added this to the top of the activity stream. It’s just the start of a section to change the navigation based on the chemistry teacher. More details will be added to each if statement after the basic code works for everyone. Options for field=Instructor “Heiny” “Ellis” “Brooks” “Susilla” “Other” “None” might also have left this blank.

    `

    Your chemistry instructor is: Dr. Heiny

    Your chemistry instructor is: Mrs. Ellis

    Your chemistry instructor is: Mr. Brooks

    `

    However, what if the kid didn’t complete that area and the field is blank? Is this correct?

    `

    You have not chosen a chemistry instructor in your profile. Please edit your profile today.

    `

    How can you build a dynamic link to the person’s profile in the above code?

Viewing 1 replies (of 1 total)
  • When you say ‘left these blank’ then that can be checked by doing:
    `
    if (bp_get_member_profile_data( ‘field=instructor’ )) {
    if (bp_get_member_profile_data( ‘field=instructor’ ) == ‘ Heiny’ )
    ‘do stuff’;
    if (bp_get_member_profile_data( ‘field=instructor’ ) == ‘none’)
    ‘default selection has been saved’;
    }else{
    ‘User has not visited profile and made a selection or simply re saved profile’;
    }

    `
    However I may not be following what you are trying to do here fully. If you have used radio options then you can set one option as default i.e the ‘None’ which would be selected if profile simply re-saved, if the member hasn’t visited their profile then nothing should have been saved.
    Think that work, at least it works running it quickly on a test install but I may have overlooked something crucial :)

    With the markup please change the ‘div’ to paragraph tags, divs are a semantically null element their purpose is to aggregate and group structure into logical divisions, they must never be used to contain bare naked cdata.

    Try and avoid using inline styling generally it’s a bad thing to style inline, add IDs or classes to the elements to use as styling hooks.

    ‘Strong’ is an a semantic element that is intended to confer special emphasis to a word or phrase if just needing to draw attention to a word then adding typographic conventions to it would be acceptable e.g <b> to embolden the characters, however in this instance you are probably better off using spans as a means of separating a section of the text to add distinct styling to.

Viewing 1 replies (of 1 total)
  • The topic ‘Code cleanup and what about blank xprofile data? (Need dynamic link to profile)’ is closed to new replies.
Skip to toolbar