Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Help: How to Display Editors Profile Info on Category Page

Quote Reply
Help: How to Display Editors Profile Info on Category Page
Within Category.html it does display Editors username, however I am wondering if there was some global that will enable an option where any information from editors profile can be displayed, for example, Name, Email, Company Name & Site URL.

Thank you.

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] Help: How to Display Editors Profile Info on Category Page In reply to
Hi,

Not really played with editor stuff much, but I'm guessing it would be something like:

<%load_editor_details($Username)%>

..then a global, called load_editor_details, with the following:

Code:
sub {
my $user = $DB->table('Users')->select( { Username => $_[0] } )->fetchrow_hashref;
return $user;
}

You should then have access to the value of the Editors profile (from glinks_Users).

If that doesn't work, you may need to use this:

Code:
return { %$user };

..instead of:

Code:
return $user;

Hope that helps/works Smile

.

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Help: How to Display Editors Profile Info on Category Page In reply to
For some reason it don't seem to work.

I did notice that when I use <%GT::Template::dump%> in the footer, it does include below in the output:

Code:
editors_loop[
{
'CanAddCat' => 'Yes',
'CanAddEdit' => 'No',
'CanAddLink' => 'Yes',
'CanAddRel' => 'No',
'CanCopyLink' => 'No',
'CanDelCat' => 'No',
'CanDelLink' => 'Yes',
'CanModCat' => 'No',
'CanModLink' => 'Yes',
'CanModReview' => 'No',
'CanMoveCat' => 'No',
'CanMoveLink' => 'No',
'CanValLink' => 'No',
'CategoryID' => '1',
'Company_Name' => 'Yahoo',
'Email' => 'johndoe@yahoo.com',
'Grouping' => '0',
'Name' => 'John Doe',
'Password' => 'password here',
'PerPage' => '15',
'ReceiveMail' => 'Yes',
'SortField' => 'Title',
'SortOrd' => 'ASC',
'Status' => 'Registered',
'Username' => 'johndoe',
'Validation' => '98765432109876543210'
}
];




However I am not able to display selected fields for normal viewing.

Any thoughts?

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] Help: How to Display Editors Profile Info on Category Page In reply to
Hi,

Mmm.. so doing:

Code:
<%if editors_loop%>
<%loop editors_loop%>
<%Username%> - <%Name%> <br />
<%endloop%>
<%endif%>

..doesn't work?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Help: How to Display Editors Profile Info on Category Page In reply to
Wow.. it works, without the use of any global.. sweet.. :)

I am able to see it working on category.html however for some reason it does not display any output on add.html page & also on add.html the use of <%GT::Template::dump%> does not display the editors_loop either.

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] Help: How to Display Editors Profile Info on Category Page In reply to
Hi,

Quote:
Wow.. it works, without the use of any global.. sweet.. :)

:)

Quote:
I am able to see it working on category.html however for some reason it does not display any output on add.html page & also on add.html the use of <%GT::Template::dump%> does not display the editors_loop either.

Erm, thats to be expected <G> Why would you want to use it there? The editor_loop loop is only made on category.html (and detailed.html, I belive). There is no need for it to exist on the add templates, thus why it doesn't <G>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Help: How to Display Editors Profile Info on Category Page In reply to
I am working on a specialized directory, where editor will actually be companies having control of certain categories for given time. In addition to that, on the top right (parallel to logo) there will be editors logo & company information.

Is there anyway to display editors information on add.html (or even better on any page) by using category ID #, as category ID #, Name & the whole category_loop is available on add.html page?

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] Help: How to Display Editors Profile Info on Category Page In reply to
Hi,

You could try this:

Code:
sub {
my $categoryID = $_[0];
my $user = $DB->table('Editors')->select( { CategoryID => $categoryID } )->fetchrow_hashref;
return { %$user };
}

...then cal with:

<%global_name(CATEGORYID)%>

...then you should have the values from the Editors table for the CategoryID you provided Cool

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Help: How to Display Editors Profile Info on Category Page In reply to
Hey Andy,

I tried the above global and called it via <%editorsinfo_on_add_page(1)%> (1 is the ID # for the category I am testing this info on) however it still don't want to work :( .. Also is there a way to insert category ID in the global calling code automatically.

Below the global calling code I also used <%GT::Template::dump%> to see if it would display editors loop, but it did not :(

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] Help: How to Display Editors Profile Info on Category Page In reply to
Hi,

Try replacing:

Code:
return { %$user };

..with:

Code:
return $user;

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Help: How to Display Editors Profile Info on Category Page In reply to
Still no output with global or in <%GT::Template::dump%>

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] Help: How to Display Editors Profile Info on Category Page In reply to
Hi,

Is there more than one record with CategoryID = 1 in the glinks_Editors table?

You may need to use something like this:

Code:
sub {
my $categoryID = $_[0];
my $tbl = $DB->table('Editors');
$tbl->select_options('LIMIT 1');
my $user = $tbl->select( { CategoryID => $categoryID } )->fetchrow_hashref;
return $user;
}

I know the "return $code" code works fine, as I just did a test one one of my sites, and it came up fine:

Code:
Available Variables
/header_font
CanAddCat Yes
CanAddEdit Yes
CanAddLink Yes
CanAddRel Yes
CanCopyLink Yes
CanDelCat Yes
CanDelLink Yes
CanModCat Yes
CanModLink Yes
CanModReview No
CanMoveCat Yes
CanMoveLink Yes
CanValLink Yes
CategoryID 7317
Username test

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Help: How to Display Editors Profile Info on Category Page In reply to
CategoryID = 1 only have 1 editor listed in it.

Above global does display Editors Username within Category Value, however it does not give any option to display any other information for that particular editor, i.e. Editors company Name, Info, .. etc

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] Help: How to Display Editors Profile Info on Category Page In reply to
Ok, so it does show things like: CanMoveLink then?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Help: How to Display Editors Profile Info on Category Page In reply to
Yes it does show following category options for editor:

CanAddCat No
CanAddEdit No
CanAddLink Yes
CanAddRel No
CanCopyLink No
CanDelCat No
CanDelLink Yes
CanModCat Yes
CanModLink No
CanModReview No
CanMoveCat No
CanMoveLink No
CanValLink No

But no other information from editors profile.

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] Help: How to Display Editors Profile Info on Category Page In reply to
Hi,

You should have just said :P Thats easy ;

Code:
sub {
my $categoryID = $_[0];
my $tbl = $DB->table('Editors');
$tbl->select_options('LIMIT 1');
my $editor = $tbl->select( { CategoryID => $categoryID } )->fetchrow_hashref;
my $user = $DB->table('User')->select( { Username=> $user->{'Username'} } )->fetchrow_hashref;

my $return;

map { $return->{$_} = $user->{$_} } keys %$user;
map { $return->{$_} = $editor->{$_} } keys %$editor;

return $return;
}

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Help: How to Display Editors Profile Info on Category Page In reply to
hum.. I just tried above global (editor_info2), however received following error:

Code:
Unable to compile 'editor_info2': Global symbol "$user" requires explicit package name at (eval 20) line 1

& still even the use of dump don't display any other information from editors profile on add listing page.

** edit **
in the dump output I do see
editor_info2 sub { () };

Vishal
-------------------------------------------------------

Last edited by:

SWDevil.Com: Apr 15, 2007, 7:50 AM
Quote Reply
Re: [SWDevil.Com] Help: How to Display Editors Profile Info on Category Page In reply to
By the way, it gives the same output also on detailed.html page (I have added global in include_footer.html)

Also, dump tag for detailed and add page don't show editors profile information.

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] Help: How to Display Editors Profile Info on Category Page In reply to
Hi,

Try this:

Code:
sub {
my $categoryID = $_[0];
my $tbl = $DB->table('Editors');
$tbl->select_options('LIMIT 1');
my $editor = $tbl->select( { CategoryID => $categoryID } )->fetchrow_hashref;
my $user = $DB->table('Users')->select( { Username=> $editor->{'Username'} } )->fetchrow_hashref;

my $return;

map { $return->{$_} = $user->{$_} } keys %$user;
map { $return->{$_} = $editor->{$_} } keys %$editor;

return $return;
}

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Help: How to Display Editors Profile Info on Category Page In reply to
Hi Andy,

That seem to have done the trick :) & works like a charm.

I was wondering if there was a way around having to manually include category ID in the global calling code.

Thank you.

Vishal
-------------------------------------------------------