Print

After installation, please follow this guide on how to use the User Field Values In Articles extension.

Table of contents

 

Adding user field values to content

  1. Open an article to edit or create a new article.

  2. You will notice that a new editor button is available namely Insert User Field Shortcode



    NOTE: Please note that the position of this button will be variable depending on your editor type. e.g JCE, TinyMCE etc


  3. Clicking on the Insert User Field Shortcode will bring up a Modal window displaying all available user fields e.g. email, Id, name etc. Custom field types will show up automatically on creation.

    The modal window will show the contents of the User Field Values In Articles component. The first column in the Modal window contains the Title, next the description and then the last column the usage or short code 'This shortcode' can also be used to manually add user field values to articles.




  4. The title column within the modal window is clickable, meaning that when we click on the Email link within the title column, the email shortcode {{ud_email}} will be added to the article.

    See example below:







  5. Now save the article.

  6. The next time a user login to your website, the {{ud_email}} placeholder/ shortcode will be replaced with his email address




  7. You can also place the email shortcode and text within the {{ud_user}} tags, meaning that this text will only show when the user is logged-in, in the contrary to the {{ud_user}} tags we have the {{ud_guest}} tags which means that only guest users will see the text posted within the guest tags.

    See example




    The logged in user will see the following:


    while the guest user/ not authenticated user will see the below:

How to use short codes manually

  1. Short codes might be easier to memorise, print or open a reference list of short codes within a new window/ tab while working on your article.

  2. To see a list of available short codes simply open the Joomla! Administrator panel and click on 
    Components->User Field Values in Articles.

  3. This will open up a new window showing all available short codes/ placeholders.

  4. The first column contains the Title for the field value, followed by a short description and finally the third column named Usage contains the actual short code.



  5. Now copy the user field short code and add it manually to your article were you would like the user field value to show.

    For example take the {{ud_username}} short code and add it to you article.



    The next time the user opens the article after login, the users username will show:




Showing content to logged in users only

  1. Most of the time you only want user field values to show when a user is authenticated/ logged into your Joomla! site.

  2. This can be done by using the user block short code tags.

    {{ud_user}}This content will only show when the user is logged in{{ud_user}}


  3. Open an article to edit or create a new article.

  4. Click on the Insert User Field Shortcode editor button.



  5. A modal window will show up displaying all available user fields together with all related short codes.

  6. Select the User Block title. 

    NOTE: This can also be done manually. Also not that user field values can be added within this block.




  7. This will add the following to your Joomla! article.




  8. Save the article.

  9. Whenever a user signs in the authenticated user will see the text, whereby a guest user won't see this:


Showing content to guest users only

  1. Sometime you would like to show content only to guest Joomla! users.

  2. This can be done by using the guest block short code tags.

    {{ud_guest}}Only non logged in users will see this{{ud_guest}}


  3. Open an article to edit or create a new article.

  4. Click on the Insert User Field Shortcode editor button.



  5. A modal window will show up displaying all available user fields together with all related short codes.

  6. Select the Guest Block title. 

    NOTE: This can also be done manually.



  7. This will add the following to your Joomla! article.




  8. Save the article.

  9. Whenever a guest user visits your Joomla! website the guest user will see the text, whereby a authenticated user won't see this:

How to add custom user field values to content

  1. Our Joomla! extension User Field Values In Articles supports the following custom Joomla! User field types:
    • calendar
    • editor
    • text
    • color
    • integer
    • user
    • list
    • url
    • textarea
    • usergrouplist

  2. For example, say we have a Joomla! website were upon user registration we ask the user what's his/ her favourite colour, then once the user signs in we display the users favourite colour within an article.

  3. Let's create a custom user field type namely favourite colour.

  4. Open your Joomla! Administrator Panel and select Users->Fields->New Field

  5. Create a new user field named Favourite Colour together with the custom field type color. Click on Save and Close when done.

  6. Edit a user and assign a favourite colour to this user and click Save & Close.



  7. Open an article to edit or create a new article.

  8. Click on the Insert User Field Shortcode editor button.



  9. A modal window will show up displaying all available user fields together with all related short codes.

  10. You will notice that a new field appears namely Favourite Colour



  11. Click on the Favourite Colour title to add the favourite colour short code to the article and click on save.





  12. Now whenever a signed in user visits the page, the users favourite colour will show.




  13. The problem however is that the users favourite colour shows up in hexadecimal form, which may be unrecognisable for your average user.



  14. To counter this, open up the article for editing and click on the source code button which allows you to add in custom html to your Joomla! article.

  15. Edit the source code and add in the following code:

    <p><strong>Your favourite colour is</strong>:<span style="background-color: {{ud_favourite_colour}}; height: 15px; width: 15px;display: inline-block;"> </span></p>



  16. Reload the article on the front end and the user will see a colour block indicating his favourite colour:



    NOTE: Not only can short codes be added to articles but to an articles source code as well, allowing you to display information such as the users favourite colour within an article which makes the User Field Values In Articles super flexible.