Difference between revisions of "Suggestions"

From Dreamwidth Notes
Jump to: navigation, search
m (add SQL statement for validating email; there is no console command for this)
m (need to edit ext/local config, not dw-nonfree config)
 
(One intermediate revision by the same user not shown)
Line 11: Line 11:
 
** You can't create this normally, because "dw_" is a reserved name. You need to use a user account with "siteadmin:usernames". Assuming you're logged in as "system", go to /admin/priv/?user=system on your Dreamhack, select "siteadmin" from the drop-down at the bottom, and type "usernames" in the text box, then click "Make changes".
 
** You can't create this normally, because "dw_" is a reserved name. You need to use a user account with "siteadmin:usernames". Assuming you're logged in as "system", go to /admin/priv/?user=system on your Dreamhack, select "siteadmin" from the drop-down at the bottom, and type "usernames" in the text box, then click "Make changes".
 
** You should now be able to create the community at /communities/new
 
** You should now be able to create the community at /communities/new
* Create a new user called "suggestions_bot"
+
* Create a new user called "suggestions_bot" and have it join dw_suggestions.
 
** I did this by [[Invite code generation|creating an invite code]], and signing up a new user in a private/incognito browser window (so it wouldn't sign out my system user), but other methods for creating a user exist.
 
** I did this by [[Invite code generation|creating an invite code]], and signing up a new user in a private/incognito browser window (so it wouldn't sign out my system user), but other methods for creating a user exist.
 
* Validate the bot account's email address. Two methods:
 
* Validate the bot account's email address. Two methods:
** [[Exploring the database|Edit the database directly]] to record that the email address has been validated: <code>UPDATE user SET status='A' WHERE user='[username]';</code>
+
** [[Exploring the database|Edit the database directly]] to record that the email address has been validated: <code>UPDATE user SET status='A' WHERE user='suggestions_bot';</code>
** Just configure the bot with a valid email address, run the [[workers]] to get the email sent, and click the validation link you receive. (Check spam if the email doesn't arrive; this is what I ended up doing).
+
** Or, just configure the bot with a valid email address, run the [[workers]] to get the email sent, and click the validation link you receive. (Check spam if the email doesn't arrive; this is what I ended up doing).
 
* Make the bot an admin of the community at /communities/dw_suggestions/members/edit
 
* Make the bot an admin of the community at /communities/dw_suggestions/members/edit
 
* Make sure the community has a a paid account so anyone can post polls.  
 
* Make sure the community has a a paid account so anyone can post polls.  
 
** Give your "system" account the "payments" privilege at /admin/priv/?user=system
 
** Give your "system" account the "payments" privilege at /admin/priv/?user=system
 
** At /admin/pay/, enter dw_suggestions, and set it to have a paid account.
 
** At /admin/pay/, enter dw_suggestions, and set it to have a paid account.
* The name of the suggestions bot and the community ''ought'' to be picked up from ext/dw-nonfree/etc/config-local.pl, but that didn't seem to work for me. I ended up just editing ext/dw-nonfree/htdocs/site/suggest.bml, which is a horrid hack but did the job for what I needed. Please update this if you can find a better solution!
+
* Add the following lines to ext/local/etc/config-local.pl, before the closing curly brace:
** Replace <code>my $destination = LJ::load_user( $LJ::SUGGESTIONS_COMM );</code> with <code>my $destination = LJ::load_user('dw_suggestions');</code>
+
<code>$SUGGESTIONS_COMM = "dw_suggestions";
** Replace <code>my $suggestions_bot = LJ::load_user( $LJ::SUGGESTIONS_USER );</code> with <code>my $suggestions_bot = LJ::load_user('suggestions_bot');</code>
+
$SUGGESTIONS_USER = "suggestions_bot";</code>
  
 
[[Category: Development]]
 
[[Category: Development]]
 
[[Category: Dreamhack]]
 
[[Category: Dreamhack]]

Latest revision as of 22:20, 22 February 2016

So you want a version of the Dreamwidth suggestions page working on your Dreamhack. This document should hopefully get you there. It was written by [info]me_and in February 2016.

You will need

  • A Dreamhack.
  • An account on your Dreamhack with admin privs; your default "system" account probably suffices.

Process

  • Create a new community called "dw_suggestions"
    • You can't create this normally, because "dw_" is a reserved name. You need to use a user account with "siteadmin:usernames". Assuming you're logged in as "system", go to /admin/priv/?user=system on your Dreamhack, select "siteadmin" from the drop-down at the bottom, and type "usernames" in the text box, then click "Make changes".
    • You should now be able to create the community at /communities/new
  • Create a new user called "suggestions_bot" and have it join dw_suggestions.
    • I did this by creating an invite code, and signing up a new user in a private/incognito browser window (so it wouldn't sign out my system user), but other methods for creating a user exist.
  • Validate the bot account's email address. Two methods:
    • Edit the database directly to record that the email address has been validated: UPDATE user SET status='A' WHERE user='suggestions_bot';
    • Or, just configure the bot with a valid email address, run the workers to get the email sent, and click the validation link you receive. (Check spam if the email doesn't arrive; this is what I ended up doing).
  • Make the bot an admin of the community at /communities/dw_suggestions/members/edit
  • Make sure the community has a a paid account so anyone can post polls.
    • Give your "system" account the "payments" privilege at /admin/priv/?user=system
    • At /admin/pay/, enter dw_suggestions, and set it to have a paid account.
  • Add the following lines to ext/local/etc/config-local.pl, before the closing curly brace:
$SUGGESTIONS_COMM = "dw_suggestions";
$SUGGESTIONS_USER = "suggestions_bot";