[paid accounts] Adding "Add to memories" and "Edit" links alongside the "Leave a comment" link

Jun 04, 2005 00:20

1. Create a new theme layer. (Follow the steps in this post to create a theme layer.) If you have already created a theme layer for the style, just add the following code to it.



function print_entry(Page p, Entry e, Color bgcolor, Color fgcolor)
{
$e->print_linkbar();

# Userpic

var string userpic = "";
if ($*show_entry_userpic)
{
if ($p.view == "friends")
{
if (defined $e.userpic)
{
$userpic = $userpic + """
";
}
}
elseif ($p.journal_type == "C" and $p.view == "recent")
{
if (defined $e.userpic)
{
$userpic = $userpic + """
""";
}
}
else
{
if (defined $e.userpic)
{
$userpic = $userpic + """

""";
}
}
}
print """

""";
if (($p.view == "recent" and $p.journal_type != "C" ) or $p.view == "entry" or $p.view == "day")
{
print """$userpic""";
}
else
{
if ($p.view == "recent" and $p.journal_type == "C" )
{
"""
""";
}
else
{
"""
""";
}
print """$userpic""";

# Poster

if ($p.view == "friends")
{
var UserLite linkto;
$linkto = $e.poster;
#print "$e.poster.username";
"""
base_url() + "\">";
"$linkto.username
";
}
elseif ($p.journal_type == "C" and $p.view == "recent")
{
var UserLite linkto;
$linkto = $e.poster;
#print "$e.poster.username";
"""
base_url() + "\">";
"$linkto.username
";
}
if ($p.view == "friends" and $e.poster.username != $e.journal.username)
{
var UserLite linkto;
$linkto = $e.journal;
"""
[ base_url() + "\">";
"$linkto.username
]";
}
if ($p.view == "recent" and $p.journal_type == "C")
{
print "";
}
if ($p.view != "recent" and $p.view != "entry" and $p.view != "day")
{
print """""";
}
}

# Date, time, subject

var string time = "";
$time = $time + """ @ """;
$time = $time + $e.time->time_format("short");
var string date = "";
$date = $date + $e.time->date_format("long_day");
"""

""";
print $e.time->date_format("%%dd%% %%month%% %%yyyy%%");
"$time
";
"""

""";
if ($e.security != "")
{
$e.security_icon->print();
}
"""
$e.subject

""";

"""

$e.text """;

# Currents

var string currents ="";
$e->print_metadata();

# Comments

"""

""";
var Link edit;
var Link mem;
if ($p.view != "entry" or $p.view != "reply")
{
$edit = $e->get_link("edit_entry");
$mem = $e->get_link("mem_add");

if (defined $edit )
{
print """ $*text_edit | """;
}

print """ $*text_memories""";

if ($p.view != "entry" or $p.view != "reply")
{
$e.comments->print();
}
elseif ($e.comments.enabled)
{
$e.comments->print_postlink();
}
else
{
" ";
}
"""

""";
}
}

function CommentInfo::print() {
if (not $.enabled) { return; }
if ($.count > 0 or $.screened) {
print " | ";
$this->print_readlink();
}
print """ | """;
$this->print_postlink();
}

2. If you want to get rid of the "Edit" and "Add to memories" links at the top of each entry in the Entry and Reply pages, add the following code:



function Entry::print_linkbar()
{
# Links (memories, edit, prev, next)
var Page p = get_page();
var Link prev;
var Link edit;
var Link mem;
var Link next;
if ($p.view == "entry" or $p.view == "reply")
{
$prev = $this->get_link("nav_prev");
$next = $this->get_link("nav_next");
"""

$*text_previous_entry |
$*text_next_entry

""";
}

}

This will leave only the links to the previous and next entries at the top of the page.

Thank you to afuna for helping out with some parts of the code. :)

!old, entry comment bar, paid accounts

Previous post Next post
Up