Recent Topics

1 Oct 10, 2018 16:22    

In response to a query on how to get the correct syntax for a link/button widget :: http://forums.b2evolution.net/how-do-i-send-logged-in-user-id to provide quick access to a user's posts.

I settled on using a FreeHTML widget but the problem there was the inability to use php code to pick up the [$current_User->ID]

So
1) I created a global javascript variable in my skin header file to get the [$current_User->ID] into javascript [uid]

<script>
var uid = "<?php echo $current_User->ID; ?>";
</script>

2) Then added a FreeHTML widget calling the javascript variable: javascript being usable in the FreeHTML widget

<script>
url="http://calstock.org.uk/?disp=useritems&user_ID=" + uid;
document.write("<a href=" + url + ">My Posts :: <em>All collections</em></a>");
</script>

More code is needed if you want to limit the output to a specific collection


Form is loading...