XF 2.3 Adding an option

Anatoliy

Well-known member
So I have an add-on that allows members to post Notes. Members can see only own notes.
Now I want to add Options, so a member could select from 3 options:
Private (only him can see his notes)
Members Only (only logged users can see his notes)
Public (everyone can see his notes)

In ACP -> Options I added option group. And in that group I'm adding an option.
Edit format: Select menu
Data type: Sting
Default value: Private

But where do I put all possible variants of a select menu? In 'Format parameters'?And in what format should I put them there?

Please advise.
 
Thank you!
Now how I give to members the possibility to see that dropdown and to make a selection?
 
Or I'm playing with a wrong Options, and the one I'm playing with is for an entire board, not for individual members?
 
Hmm... Do I need instead to
extend user account preferences with a 'select' and store its value in xf_user_option?
 
I think you need to add new enum column in note table with values ['private', 'member_only', 'public'], Then when the user create note he can select type of this note. Then you can show note based on this new column for example:
HTML:
<!-- when note is private -->
<xf:if is="$note.note_type == 'private'">
    <xf:if is="$note.user_id == $xf.visitor.user_id">
        {$note.content}
    </xf:if>
<!-- when note is member only -->
<xf:elseif is="$note.note_type == 'member_only'">
    <xf:if is="$xf.visitor.user_id">
        {$note.content}
    </xf:if>
<!-- when note is public -->
<xf:else />
{$note.content}
</xf:if>
 
I think you need to add new enum column in note table with values ['private', 'member_only', 'public'], Then when the user create note he can select type of this note. Then you can show note based on this new column for example:
HTML:
<!-- when note is private -->
<xf:if is="$note.note_type == 'private'">
    <xf:if is="$note.user_id == $xf.visitor.user_id">
        {$note.content}
    </xf:if>
<!-- when note is member only -->
<xf:elseif is="$note.note_type == 'member_only'">
    <xf:if is="$xf.visitor.user_id">
        {$note.content}
    </xf:if>
<!-- when note is public -->
<xf:else />
{$note.content}
</xf:if>
Thanks! I thought about it. And it will do the trick. However it will require members to indicate note_type every time. And to give members possibility to make this selection once looks like a better idea.
 
Back
Top Bottom