How do I let new users to automatically subscribe to the fee

Support requests, bug reports, etc. go here. Dedicated servers / VDS hosting only
msilvya
Bear Rating Trainee
Bear Rating Trainee
Posts: 12
Joined: 25 Jun 2013, 21:06

How do I let new users to automatically subscribe to the fee

Postby msilvya » 25 Jun 2013, 21:21

I just set up my tt-rss site and I've set ENABLE_REGISTRATION to true in config.php. But when new users register, they are subscribed to the default Tiny Tiny RSS: Forum and Tiny Tiny RSS: New Release feeds by default and not the RSS feeds that I have created as an administrator.

I was just wondering if there's a setting/way that would allow newly registered users to be automatically subscribed to the Feeds that I have set up as an administrator of my tt-rss site?

And thank you for making tt-rss. Now nobody can tell me again to move my feeds. Take that Google! :evil:

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: How do I let new users to automatically subscribe to the

Postby fox » 25 Jun 2013, 21:34

There's no setting for that, you'll have to hack the code.

msilvya
Bear Rating Trainee
Bear Rating Trainee
Posts: 12
Joined: 25 Jun 2013, 21:06

Re: How do I let new users to automatically subscribe to the

Postby msilvya » 25 Jun 2013, 21:40

Thanks for the quick reply.

I noticed /include/functions.php has the following lines:

Code: Select all

function initialize_user($uid) {

      db_query("insert into ttrss_feeds (owner_uid,title,feed_url)
         values ('$uid', 'Tiny Tiny RSS: New Releases',
         'http://tt-rss.org/releases.rss')");

      db_query("insert into ttrss_feeds (owner_uid,title,feed_url)
         values ('$uid', 'Tiny Tiny RSS: Forum',
            'http://tt-rss.org/forum/rss.php')");
   }


while ttrss_schema_mysql.sql has the following SQL insert queries.

Code: Select all

insert into ttrss_feeds (owner_uid, title, feed_url) values
   (1, 'Tiny Tiny RSS: New Releases', 'http://tt-rss.org/releases.rss');

insert into ttrss_feeds (owner_uid, title, feed_url) values
   (1, 'Tiny Tiny RSS: Forum', 'http://tt-rss.org/forum/rss.php');



Do I need to modify these?
Last edited by msilvya on 04 Jul 2013, 11:40, edited 2 times in total.

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: How do I let new users to automatically subscribe to the

Postby fox » 25 Jun 2013, 21:53

You only need to modify initialize_user(), schema stuff is for your default admin user only.

msilvya
Bear Rating Trainee
Bear Rating Trainee
Posts: 12
Joined: 25 Jun 2013, 21:06

Re: How do I let new users to automatically subscribe to the

Postby msilvya » 25 Jun 2013, 22:08

Thanks again for replying, fox.
So, in functions.php I need change the initialize_user function and add feeds like the following?

Code: Select all

function initialize_user($uid) {

      db_query("insert into ttrss_feeds (owner_uid,title,feed_url)
         values ('$uid', '[b]My favorite feed 1[/b]',
         'http://tt-rss.org/Myfavoritefeed1.rss')");

      db_query("insert into ttrss_feeds (owner_uid,title,feed_url)
         values ('$uid', '[b]My favorite feed 2[/b]',
            'http://tt-rss.org/Myfavoritefeed2')");
   
      db_query("insert into ttrss_feeds (owner_uid,title,feed_url)
         values ('$uid', '[b]My favorite feed 3[/b]',
            'http://tt-rss.org/Myfavoritefeed3')");
   }

... and so on?

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: How do I let new users to automatically subscribe to the

Postby fox » 25 Jun 2013, 22:13

Yes, don't use bbcode in SQL though.

msilvya
Bear Rating Trainee
Bear Rating Trainee
Posts: 12
Joined: 25 Jun 2013, 21:06

Re: How do I let new users to automatically subscribe to the

Postby msilvya » 25 Jun 2013, 22:28

fox wrote:Yes, don't use bbcode in SQL though.

True. I used the BBCode in my previous comment to bold the codes but the editor here displayed it as a BBCode. :oops:

Anyway, I modified the function initialize_user($uid) as follows and registered as a new user, but again only the Tiny Tiny RSS: Forum and Tiny Tiny RSS: Releases are showing up and not the new feed. Any idea where I could be going wrong?

Code: Select all

function initialize_user($uid) {

      db_query("insert into ttrss_feeds (owner_uid,title,feed_url)
         values ('$uid', 'Tiny Tiny RSS: New Releases',
         'http://tt-rss.org/releases.rss')");

      db_query("insert into ttrss_feeds (owner_uid,title,feed_url)
         values ('$uid', 'Tiny Tiny RSS: Forum',
            'http://tt-rss.org/forum/rss.php')");
   
      db_query("insert into ttrss_feeds (owner_uid,title,feed_url)
         values ('$uid', 'My favorite feed 3',
            'http://MyFavoriteSite.org/Myfavoritefeed3')");
   }

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: How do I let new users to automatically subscribe to the

Postby fox » 25 Jun 2013, 22:40

Look for SQL errors in the log. This should be the place where those feeds are entered, so I dunno what could be wrong.

msilvya
Bear Rating Trainee
Bear Rating Trainee
Posts: 12
Joined: 25 Jun 2013, 21:06

Re: How do I let new users to automatically subscribe to the

Postby msilvya » 25 Jun 2013, 23:05

fox wrote:Look for SQL errors in the log. This should be the place where those feeds are entered, so I dunno what could be wrong.

I'm going to kick myself in the butt. I thought I was working on the remote functions.php file while the changes I had made was on a local file. :oops:

It works perfect - Thanks a lot for your help, fox!

AngryChris
Bear Rating Master
Bear Rating Master
Posts: 135
Joined: 08 Apr 2013, 02:42

Re: How do I let new users to automatically subscribe to the

Postby AngryChris » 26 Jun 2013, 00:02

Are you using an opcode cache like APC? And if you are using APC, do you have apc.stat=0 set in its configuration? If you do, then you may need to either clear your cache or bounce your webserver (if apc.stat is turned off, files are only cached the first time they are accessed, not when they change).

EDIT: Ignore this post. :P

msilvya
Bear Rating Trainee
Bear Rating Trainee
Posts: 12
Joined: 25 Jun 2013, 21:06

Re: How do I let new users to automatically subscribe to the

Postby msilvya » 03 Jul 2013, 16:47

Digging this thread again as I'm stuck with assigning the default feeds to a set of categories.

What I mean is: Currently when a user signs up, all the default feeds are assigned to a category called Uncategorised - As I posted above, I have been able to achieve this.

BUT going beyond what I have achieved, Is there a way to assign the default set of feeds to a particular category with the categories also automatically created besides the feeds? For example, Category 1 and Category 2 are automatically created while Feeds 1, 2, 3, 4 are automatically assigned to the Category 1 and Category 2 the way I want it.

So, when a user registers to my ttrss site, the user sees the following set of default feeds I have created.

Category 1
Feed 1
Feed 2
..
Feed n

Category 2
Feed 3
Feed 4
..
Feed n

and so on?

User avatar
sleeper_service
Bear Rating Overlord
Bear Rating Overlord
Posts: 884
Joined: 30 Mar 2013, 23:50
Location: Dallas, Texas

Re: How do I let new users to automatically subscribe to the

Postby sleeper_service » 04 Jul 2013, 00:25

msilvya wrote:Digging this thread again as I'm stuck with assigning the default feeds to a set of categories.

What I mean is: Currently when a user signs up, all the default feeds are assigned to a category called Uncategorised - As I posted above, I have been able to achieve this.

BUT going beyond what I have achieved, Is there a way to assign the default set of feeds to a particular category with the categories also automatically created besides the feeds? For example, Category 1 and Category 2 are automatically created while Feeds 1, 2, 3, 4 are automatically assigned to the Category 1 and Category 2 the way I want it.

So, when a user registers to my ttrss site, the user sees the following set of default feeds I have created.

Category 1
Feed 1
Feed 2
..
Feed n

Category 2
Feed 3
Feed 4
..
Feed n

and so on?


check the table layout, there's a column for what category the feed's in. assign as needed. (I could go into more detail, but then I'd have to look up table and column names, and I'm not feeling that energetic at the moment, so I figure you can do it *grin*)

AngryChris
Bear Rating Master
Bear Rating Master
Posts: 135
Joined: 08 Apr 2013, 02:42

Re: How do I let new users to automatically subscribe to the

Postby AngryChris » 04 Jul 2013, 01:06

I'd start with looking at the add_feed_category() function in functions.php:

Code: Select all

        function add_feed_category($feed_cat, $parent_cat_id = false) {

                if (!$feed_cat) return false;

                db_query("BEGIN");

                if ($parent_cat_id) {
                        $parent_qpart = "parent_cat = '$parent_cat_id'";
                        $parent_insert = "'$parent_cat_id'";
                } else {
                        $parent_qpart = "parent_cat IS NULL";
                        $parent_insert = "NULL";
                }

                $feed_cat = mb_substr($feed_cat, 0, 250);

                $result = db_query(
                        "SELECT id FROM ttrss_feed_categories
                        WHERE $parent_qpart AND title = '$feed_cat' AND owner_uid = ".$_SESSION["uid"]);

                if (db_num_rows($result) == 0) {

                        $result = db_query(
                                "INSERT INTO ttrss_feed_categories (owner_uid,title,parent_cat)
                                VALUES ('".$_SESSION["uid"]."', '$feed_cat', $parent_insert)");

                        db_query("COMMIT");

                        return true;
                }

                return false;
        }

It looks like the relevant portion that would be safe to run for a brand new user is:

Code: Select all

                        $result = db_query(
                                "INSERT INTO ttrss_feed_categories (owner_uid,title,parent_cat)
                                VALUES ('".$_SESSION["uid"]."', '$feed_cat', $parent_insert)");

Incorporate this into your add user changes. It looks like by default, parent_cat is null.

msilvya
Bear Rating Trainee
Bear Rating Trainee
Posts: 12
Joined: 25 Jun 2013, 21:06

Re: How do I let new users to automatically subscribe to the

Postby msilvya » 04 Jul 2013, 13:44

AngryChris wrote:It looks like the relevant portion that would be safe to run for a brand new user is:

Code: Select all

                        $result = db_query(
                                "INSERT INTO ttrss_feed_categories (owner_uid,title,parent_cat)
                                VALUES ('".$_SESSION["uid"]."', '$feed_cat', $parent_insert)");

Incorporate this into your add user changes. It looks like by default, parent_cat is null.

Thanks for replying Chris.

Does this mean that I add the following to function initialize_user($uid) {

Code: Select all

db_query("INSERT INTO ttrss_feed_categories (owner_uid,title,parent_cat)
VALUES ('$uid', 'some category', '1');


Sorry, I'm no programmer but trying my best to get this to work. :oops:

msilvya
Bear Rating Trainee
Bear Rating Trainee
Posts: 12
Joined: 25 Jun 2013, 21:06

Re: How do I let new users to automatically subscribe to the

Postby msilvya » 04 Jul 2013, 13:48

sleeper_service wrote:check the table layout, there's a column for what category the feed's in. assign as needed. (I could go into more detail, but then I'd have to look up table and column names, and I'm not feeling that energetic at the moment, so I figure you can do it *grin*)


Thanks for replying sleeper. Can you please be energetic? I really need this done :D

Here's the table layout for Browse ttrss_feed_categories

id owner_uid title collapsed order_id parent_cat view_settings

While ttrss_feeds has the following layout.

id owner_uid title cat_id feed_url icon_url update_interval purge_interval last_updated last_error favicon_avg_color site_url auth_login auth_pass parent_feed private rtl_content hidden include_in_digest cache_images hide_images cache_content auth_pass_encrypted last_viewed last_update_started always_display_enclosures update_method order_id mark_unread_on_update update_on_checksum_change strip_images view_settings pubsub_state favicon_last_checked


Return to “Support”

Who is online

Users browsing this forum: No registered users and 2 guests