This is the community forum. For a developer response use the Client Area.
Follow us on Facebook, Twitter and YouTube!

arbitrary id
#1

it would be nice if one can permit comments on pages with an arbitrary id.

I have a site with a lot of pages and I want to use commentics without having to do 'add page' for every page.

thanks
Reply
#2

Welcome to the forums. This feature is already implemented in version 1.1. It will be released early next week. A quick forum search should have revealed this.

I'm giving you three guesses...
Reply
#3

In v1.1 you will be able to enter a custom ID when creating a page.

However you will still need to create the page in the admin panel.

One of the reasons for this is so that each page can have its own settings such as disabling the form.

This is unlikely to change.

Edit: I might look into the ability to add lots of pages in one go.

Have you completed the interview?
Reply
#4

Ah, yes. I have an idea as to how to do that. It requires a slight modification. I'll show an example as soon as I can get it to work.

I'm giving you three guesses...
Reply
#5

Here it is:
PHP Code:
<?php 
/**************************************************ADMIN ADDITION**************************************************/
if ($is_admin){ if (isset($_POST['submit'])) {

$reference = $_POST['reference'];
$url = $_POST['url'];

$reference = sanitize($reference);
$url = sanitize($url);

mysql_query("INSERT INTO pages (reference, url, is_form_enabled, dated) VALUES ('$reference', '$url', '1', NOW())");
?>
<div class="success">Page added: [<?php echo $reference; ?>] [<?php echo $url; ?>]</div>
<div style="clear: left;"></div>
<?php } ?>

<form name="add_page" id="add_page" action="<?php echo "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; ?>" method="post">
Reference: <input type="text" name="reference" size="30" maxlength="250"/>&nbsp;
URL: <input type="text" name="url" size="45" maxlength="250" value="<?php echo "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; ?>"/>&nbsp;
<input type="submit" class="button" name="submit" title="Add Page" value="Add Page"/>
</form><?php }
/******************************************************************************************************************/

Put that in "includes/commentics.php" after admin detection. What it does is check if the user is an admin, adds an input field to add that page, inserts the full page url as the default value, and inserts a new page in the database. I could make it so that it automatically adds the page to the db, but that would be unwanted. It requires the user to click the 'add page' button, but it is closer to an arbitrary id this way.

I'm giving you three guesses...
Reply
#6

hmm I don't think the 'reference' and 'url' will be in the $_POST data.

Have you completed the interview?
Reply
#7

Huh? When the user submits the data, it goes into the $_POST variable. It should say "page added:[$reference] [$url]" which are taken from $_POST

I'm giving you three guesses...
Reply
#8

In Manage -> Pages in the admin panel, sure, 'reference' and 'url' will be in the $_POST data.

But you're putting the above code on the frontend in includes/commentics.php?

Have you completed the interview?
Reply
#9

Well, I did add a check to see if the user is an admin. Also, I took the code from the backend and modified it slightly. The pages are successfully added for me.

I'm giving you three guesses...
Reply
#10

Okay well if it's working then I guess I can't argue Smile

Have you completed the interview?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)