You can use get_current_user_id()
to get the ID of the current user, and in your case, you can do so to print the user ID in the JavaScript Li.re()
call:
<script type="text/javascript">
Li.re( 'ab12','<?php echo get_current_user_id(); ?>' );
</script>
And yes, you can include the user ID as part of a shortcode: (note that I omitted the href
parameter for simplicity)
<?php echo do_shortcode( '[mycred_link subid1="' . get_current_user_id() . '"][/mycred_link]' ); ?>
PS: Your shortcode was missing the closing ]
tag, so I added it above. All shortcode parameter values should also be wrapped in single/double quotes.