Wonder if anyone can help me out here....

I'm doing some custom themeing on how our forums look, and am removing the print $links

to replace it with specific links I want and in specific places. With the friendly assistance of contemplate it is going well, but I've run into a bit of trouble.

Contemplate doesn't seem to pull out the code for Edit, Delete, Reply, or Link.

The reply and link I don't need (have elsewhere), but I'm looking to put the Edit and Delete back in.

I've read a little bit about the template_preprocess etc ... but it's taking a while to sink in, and was hoping there was an easier way to get those pieces out. :)

Any thoughts?

CommentFileSizeAuthor
#5 Picture 14.png87.59 KBridefree

Comments

michelle’s picture

Status: Active » Fixed

Use the $links_array variable instead of $links and just print the ones you want out of the array.

Michelle

ridefree’s picture

hey michelle,

thanks. will try that.

also just found this
http://drupal.org/node/190135

that has some pieces that are useful.

btw ... you may want to have a gander at our forums.

rabble.ca/babble

i'm in the midst of doing upgrades to get the latest code into live with new adv profile and wysiwig updates as well.

working pretty well and a large user base (though a lot of complaints as we transitioned from the old UBB software. But newer folks like it )

really great work you've done with Adv Forum. !!!!!! :)

ridefree’s picture

well...

not so great at how to work with all the variables array etc.
but when trying:

 print_r($node->links)

or even

 print_r($links_array)

I just get the same variables that are exposed in the contemplate. Which don't include the EDIT/DELETE etc.

i'll keep trying to figure out how to do this and post back if I do ( the link I put above did kinda work, tho just for the comments and not the topic itself :)

but of course if you have more tips .. gracias :)

michelle’s picture

Oh, you're talking about on the node? The node never has edit/delete links from core. So, no, they won't be in that variable. You'd have to just make the link yourself.

Michelle

ridefree’s picture

StatusFileSize
new87.59 KB

:)

well the node didn't actually have the Delete/Edit on it. But comments did.


    
 if ($top_post): 
         if (user_access('administer comments')): 
               $content_type_name = node_get_types('name', $node); 
               $quick_links['quick-edit'] = array('title' => 'Edit ' . $content_type_name, 'href' => 'node/' . $nid . '/edit'); 
               $quick_links['quick-delete'] = array('title' => 'Delete ' . $content_type_name, 'href' => 'node/' . $nid . '/delete');
                    <div class="links quick-edit-links">
               print theme('links', $quick_links, array('class' => 'links inline')); 
         </div>              
          endif;
     endif;

      if (!$top_post): 
          print '<ul><li><a href="'.base_path().'comment/edit/'.$comment->cid.'">edit this comment</a></li><li><a href="'.base_path().'comment/delete/'.$comment->cid.'">delete this comment</a></li></ul>';
      endif; 
ridefree’s picture

Priority: Normal » Minor
Status: Fixed » Postponed (maintainer needs more info)

Just going to make this active again until I figure it out. Spoke too soon before and figured I should keep what I'm doing posted for others. But any advice is great. :)

So I've found how to break out the Delete/Edit in $links. But have come across a new issue.

Using contemplate am not able to get the full functionality of Comment Mover (ie. contemplate just gives me the link for prune and doesn't auto switch)

Also the code below only shows Comment Mover/fasttoggle status/ abuse flag/ quote only on the node and not the comment.

I'm sure this is where knowing more about the insides of drupal would help. I tried switching out $node with $comment. But no dice. Gonna keep on reading up on this stuff and see what I can learn.


<ul class="links forum-links">

<li class="first "> <a href="/<?php print $node->links['comment_mover_node_prune']['href'] ?>?<?php print $node->links['comment_mover_node_prune']['query'] ?>" title="<?php print $node->links['comment_mover_node_prune']['attributes']['title'] ?>">  <?php print $node->links['comment_mover_node_prune']['title'] ?></a></li>

<li> <a class="<?php print $node->links['fasttoggle_status']['attributes']['class'] ?>" href="/<?php print $node->links['fasttoggle_status']['href'] ?>?<?php print $node->links['fasttoggle_status']['query'] ?>" title="<?php print $node->links['fasttoggle_status']['attributes']['title'] ?>"> <?php print $node->links['fasttoggle_status']['title'] ?> </a></li>

    <?php if ($top_post): ?>
       <?php if (user_access('administer comments')): ?>
                 <?php print '<li class="comment_edit"><a href="'.base_path().'node/'.$node->nid.'/edit/">Edit</a></li> <li class="comment_delete"><a href="'.base_path().'node/'.$node->nid.'/delete/">Delete</a></li>'; ?>
       <?php endif; ?>


    <?php endif; ?>

    <?php if (!$top_post): ?>
       <?php if (user_access('administer comments')): ?>
          <?php print '<li class="comment_edit"><a href="'.base_path().'comment/edit/'.$comment->cid.'">Edit</a></li><li class="comment_delete"><a href="'.base_path().'comment/delete/'.$comment->cid.'">Delete</a></li>'; ?>
       <?php endif; ?>
    <?php endif; ?>

<li class="abuse_flag_node"><a href="/<?php print $node->links['abuse_flag_node']['href'] ?>" class="<?php print $node->links['abuse_flag_node']['attributes']['class'] ?>" title="<?php print $node->links['abuse_flag_node']['attributes']['title'] ?>">  <?php print $node->links['abuse_flag_node']['title'] ?></a>

<li class="last quote"> <a href="/<?php print $node->links['quote']['href'] ?>?<?php print $node->links['quote']['query'] ?>#<?php print $node->links['quote']['fragment'] ?>" title="<?php print $node->links['quote']['attributes']['title'] ?>">  <?php print $node->links['quote']['title'] ?></a>

</ul>

michelle’s picture

This issue really doesn't have anythign to do with AF. I'll leave it open for a while, but you'd have a lot more eyes on it if you posted in the forums. I don't have the time right now to try and follow what you're doing there and I don't even use contemplate so I'm no help there.

Michelle

ridefree’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

ok. will do. i'll close it here then.
brian