Related Records Field: Current User?

5 posts by 2 authors in: Forums > CMS Builder
Last Post: May 24, 2011   (RSS)

By Perchpole - May 24, 2011

Hello, All -

I'm trying to set-up a Related Records field in the editor. I want it to list all of the records created by the current user.

How do I define the MySQL Where clause?

I'm guessing it should be something like...

createdByUserNum= $x

Where $x is the code which defines the current user.

:0/

Perch

Re: [zip222] Related Records Field: Current User?

By Perchpole - May 24, 2011

Hi, zip222 -

I thought the same - but I also assumed I should be able to define the current user without first needing to install the membership plugin...

I hoped my call could be made to work without it.

:0/

Perch

Re: [Perchpole] Related Records Field: Current User?

By zip222 - May 24, 2011

Are you trying to do this within the CMS? or on the public site? I have used this variable with the CMS without enabling the membership plugin. Here is a snippet of the code

$where="WHERE num='".$CURRENT_USER['num']."'";

Re: [zip222] Related Records Field: Current User?

By Perchpole - May 24, 2011

Hi, Zip222 -

The code I came up with is this...

createdByUserNum=<?php echo htmlspecialchars(@$CURRENT_USER['num']) ?>

It seems to do what I want!

:0)

Perch