Giter Club home page Giter Club logo

postworld's People

Contributors

ansonphong avatar astralmedia avatar hmikhail avatar iotus avatar michelhabib avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

postworld's Issues

calculate_post_points() - Documentation Error

Hi Haidy,
I made the mistake when documenting the points functions of writing basically the same thing for both calculate_post_points() and cache_post_points()

Essentially, calculate_post_points() should just calculate and return the points, and cache_post_points() can use calculate_post_points() and additionally update the values in the database.

I have updated the docs to this specification, and the change can be made.
Thanks

Database Structure Update

Hi Haidy,

Here you will find updated documentation for the Database structure, which makes the old Evernote documentation obsolete.

https://github.com/phongmedia/postworld/blob/master/dev/DATABASE-STRUCTURE.md

There are a few updates to the structure

  1. USER_META : Updated methods of user_share_report() stored in __ share_points_meta__ column
  2. USER_META : Merging of 'Favorites' and 'Viewed' into one single column post_relationships with the addition of view_later and recently voted on posts
  3. Addition of comment_relationships

All the functions which this affects, I will be documenting and will submit as issues to be updated.

These operations have been assigned to you :

  1. Go through /php/postworld_install.php and update all the table structures to match the new documentation.
  2. Update any functions affected by the changes.

Today I will be documenting all changes to the functions.

Thanks!
Phong

pw_get_templates ( $templates_object )

Hello phong,

I have a question concerning pw_get_templates

In case of if($templates_object['posts']), if template name is link-detail.html
The scenario will be as follows: (please confirm)

Check if ( link-detail.html doesn't exist in override path then use post-list.
and if post-list is not present in the override path then use that in the default path?

set_*() PHP Methods - Security

For all the *set...() *_ PHP Methods, I discovered a security hole wherby users could set the values of other users if they know their user_id. As a result, let's remove 'user_id' from the input parameters, and instead check which user is currently calling the set function, and apply it to that user ID.

This is how to get the ID of the current user :
**
$current_user = wp_get_current_user();
$current_user_ID = $current_user->ID;
**

This applies to the following functions:
set_points()
set_favorites()
set_viewed()

Post Relationship Methods

Hi Haidy,
Corresponding with the database structure update, there are some new functions to getting and setting data to the post_relationships column in the User Meta table which you can create.

You can see the updated database structure here :
https://github.com/phongmedia/postworld/blob/master/dev/DATABASE-STRUCTURE.md#post_relationships--json

Here are the new functions :

  • get_post_relationship()
  • set_post_relationship()

You can find the documentation here :
https://github.com/phongmedia/postworld/tree/master/php#set_post_relationship-relationship-post_id-user_id-switch-

I will update descriptions of get_viewed(), get_favorite(), is_favorite(), etc, as wrappers for this function.

Thanks.

Questions

Phong, from where could I get the post_class in wp_postworld_post_meta table?
I found a function get_post_class($class, $post_id) : http://codex.wordpress.org/Function_Reference/get_post_class
which returns : array() {
0 => string 'post-[ID]' (length=7)
1 => string '[post_type]' (length=4)
2 => string 'type-[post_type]' (length=9)
3 => string 'status-[post_status]' (length=14)
4 => string 'format-[post_format]' (length=15)
5 => string 'hentry' (length=6)
6 => string 'category-[...]'
X => string 'tag-[...]'
}

which field should I use? The category?

Load-Feed Directive

Hi Phong, i was discussing with Haidy the Load-Feed Directive.
it seems that all related PHP functins are already created.
However i am still going to work on the JS part, it seems simple given that we have the framework already in place.
I just needed to confirm how it works from a user perspective.
Where will the user register feed [administrator feature only?] Should he have a button where he can register a feed after changing parameters in the live feed component on the page?
Load Feed seems to be only a feed, no search panels, since it will just display pre-cached results.
The more you tell about the user experience, the easier it will be for me to figure out what needs to be done. i will do something quickly to prototype it for now.

Points Functions - Refactor

Hi Haidy,
I added some functions for Comment Points to the documentation, and updated your spreadsheet here, highlighted in green:

Production Spreadsheet:
https://docs.google.com/a/phong.com/spreadsheet/ccc?key=0AuJE3deO2IR6dGhrY1h3NkNrcG1rT1cyUmV1Nlh3d2c&usp=drive_web#gid=0

Updated Documentation:
https://github.com/phongmedia/postworld/tree/master/php#points

Have a look at the refactored method for using the meta-function 'set_points', which set_comment_points and set_post_points can be wrapper functions of. Let me know if you have any questions about this.

pw_get_templates() Panels - Returns Array.html

Hi Haidy,
You can see the issue in this case :
Make a file theme-dir/postworld/templates/panels/load_feed_A1.html

json_encode(pw_get_templates(array('panels' => array('load_feed_A1'))));

Produces :

{"panels":{"load_feed_A1":"http:\/\/localhost:8888\/wp-content\/themes\/RSV2\/postworld\/templates\/panels\/Array.html"}}

You will notice that the filename is Array.html, with 'Array' instead of the template_id.

Edit Field Directive - Data Model

Hi Michel,
The Edit Field directive is ready for your review.

Much of the prototype is in place in terms of inserting HTML. Now it is ready for you to work your magic, which will lead-in to the methods for the Edit Post directive and routing methods which I plan to document this week.

If you look in /dev/theme/ you will find a template called : edit-post.php

If you copy that to your theme folder, and make a new page with that template set (Edit Post), then you will see a working example of the directive.

It currently allows you to produce an input field, or a select field, or a text-area, with various settings which are documented here.

https://github.com/phongmedia/postworld/tree/master/js#edit-field--postworlddirective-

What I would like to do with it which I am looking for your help with :

  1. Setup a 'bind' data attribute, which binds it to the specified model via ng-model. For instance, with this :
<span edit-field="post_title" data-input="input-text" data-bind="edit_fields.post_title"></span>

The post_title field should be bound to the edit_fields.post_title variable, so when we update this on the DOM, the model changes - so when we're ready to save the post via AJAX, all we have to do is submit the edit_fields object to pw_update/insert_post() PHP method.

Does this make sense? What's the best way to do this?
There are other more advanced fields which we'll want to have controllers synching up to a central object, although this is a good place to start.

Points Meta Additions

Hi Haidy,
I have made some modifications to the following table structure and functions. You can go ahead and make updates.

  • Table Structure for : wp_postworld_ user_meta
    • Please add a post_points_meta column
    • This will allow us to contain various points data for the user, for the immediate use we can store a breakdown of points by post_type

post_points_meta :

{
    post_type : {
        post : 242,
        link : 523,
        blog : 123,
        event : 12
    }
}
  • set_post_points()
    • NEW Methods update to reflect post_points_meta
  • calculate_user_posts_points()
    • NEW Methods update to reflect post_points_meta

Have a look through the updated documentation for these functions, and let me know if you have any questions. You can go ahead and make the new post_points_meta column in user_meta table , and update the functions.

I added several HINTS where I found it easier to describe things in PHP code which you may be able to re-use. Once the function is updated, I will remove the hints from the documentation.

https://github.com/phongmedia/postworld/tree/master/php

Postworld / Wordpress Bugs & Clashes

  • When I activate Postworld, this error is formed :

The plugin generated 1998 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.

I think it's the result of MySQL errors, since when I turn off MySQL errors on various definitions, the number reduces.

  • When I logout - I can't logout, it doesn't log out. I think there is an error generated by Postworld somewhere which is stopping log-out.
  • When I try to load the admin or login page after I have been logged out due to session expiration, the /wp-admin won't load. It's just a white screen.
  • A white screen happens when activating other plugins and editing taxonomies, adding/updating posts, etc.
  • All of this ends when disabling Postworld as an active plugin

pw_live_feed Function

Phong, i am trying to use some functions through Ajax, namely pw_live_feed.
Did you work on that function? or is Haidy supposed to complete it?
I am not getting expected results. and getting the following warnings multiple times.

! ) Warning: Invalid argument supplied for foreach() in D:\wamp\www\wordpress\wp-content\plugins\postworld\php\postworld_posts.php on line 406

Warning: array_slice() expects parameter 1 to be array, object given in D:\wamp\www\wordpress\wp-content\plugins\postworld\php\postworld_feeds.php on line 23

pw_live_feed

Aqua Resizer

Aqua Resizer file is missing from the repo, it generates error when activating the plugin or using it. We should either add the missign file, or remove references to it if not being used.

The following is the common warning/error appearing in all pages:-
include_once(C:\wamp\apps\wordpress\htdocs\wp-content\plugins\postworld/submodules/Aqua-Resizer/aq_resizer.php): failed to open stream: No such file or directory on line 6 in file C:\wamp\apps\wordpress\htdocs\wp-content\plugins\postworld\php\postworld_images.php
Warning include_once(): Failed opening 'C:\wamp\apps\wordpress\htdocs\wp-content\plugins\postworld/submodules/Aqua-Resizer/aq_resizer.php' for inclusion (include_path='.;C:/wamp/php/PEAR') on line 6 in file C:\wamp\apps\wordpress\htdocs\wp-content\plugins\postworld\php\postworld_images.php

Live Feed Directive - Template Glitch

Hi Michel,
I found a bug in the live-feed directive. Perhaps you already know about this.

When you change the post view template, and then do infinite scrolling, when it loads the new posts with the previous / original post view template, not the new one that it's set to.

Are you able to re-create that?

pw_register_feed() only returning 10

Hi Haidy
When I run pw_register_feed(), then it's only returning the first 10 results, even if 'post_count' is set to 200. I have to add a 'posts_per_page' value in order to make it return more than 10.

Let's make post_count an alias for posts_per_page.

Favorites Method

Hi Haidy,
There is a small adjustment to the favorites method which will allow for more flexibility in the future. Here are the adjustments :

PHONG :

  • I removed remove the s from set_favorites() function.
    • set_favorites() >> renamed to >> set_favorite()*
  • I created wp_postworld_favorites Table
  • I created a column in wp_postworld_posts_meta which has a number for favorites

The documentation has been updated to reflect this changes :
https://www.evernote.com/shard/s275/sh/7fd5bb62-0902-4050-9889-338f847d044c/5fe6f3da3510557663e8693251ac8557

**HAIDY : **
These updates can be made to the set_favorite() method.

  • set_favorite()
    • Add or remove row in wp_postworld_favorites, with user_id and post_id
    • If it was added or removed, add 1 or subtract 1 from table wp_postworld_post_meta in column favorites

That is all for now. The rest of the favorites methods will still operate in the same way. This new favorites DB table will allow us to see how many people have favorited each post, and also it will allow us to query on favorites in the future.

pw_get_post_meta() PHP Method - Creation

Hi Haidy,
Here is a function which will be really helpful while creating the get_post_data() function which I am working on right now. This might also work well as a meta-function for any other functions which access this data.

Do you think that would affect performance?

Here is the function, it is also listed in the documentation.
https://www.evernote.com/shard/s275/sh/7fd5bb62-0902-4050-9889-338f847d044c/5fe6f3da3510557663e8693251ac8557

pw_get_post_meta( $post_id )
• Get an Associative Array of all columns in the wp_postworld_post_meta table
• Keys are column names, values are values
return : Array
'post_id' => {{integer}}
'author_id' => {{integer}}
'post_class' => {{string}}
'post_format' => {{string}}
'link_url' => {{string}}
'post_points' => {{integer}}
'rank_score' => {{integer}}

get_user_vote_points () PHP Method - Creation

Hi Haidy,
I modified the postworld_install_data() function so that it pre-populates the wp_postworld_user_roles table with the basic necessary to start working on the get_user_vote_points () function.

If you de-activate and then re-activate the Postworld plugin in the Wordpress plugins manager, you should see this data in place.

Administrator 10
Editor 5
Author 2
Contributor 1
Default 1

DB Table Name References

Hi Haidy,
In the main postworld.php file, there is a global object $pw_table_names which defines the names of the databases, depending on what the user has set their default wordpress db prefix (default is 'wp_') as well as the default Postworld prefix (default is 'postworld_')

Since the user may have customized their wp_ prefix, or we may choose to change the Postworld prefix to pw_ in the future, we should reference this object in all the functions where the table names are required.

This would involve making $pw_table_names GLOBAL in all functions which use the database, and then referencing the tables by $pw_table_names['post_meta']. Do you think this is this the best way to do it, or is there a better method?

AngularJS Version

I ran into some issue today that triggered a question related to which AngularJS version should we use.
The issue is a minor one, about how to make AngularJS initiate Ajax Requests with Post Data as in a form. this makes it easier for the server side to parse and work with request's arguments [post data].
While it is not possible out of the box in version 1.0.8 of Angular, which is the release that we are using; There are 2 solutions. 1 - is to make some workaround on the server side. 2 - is to work with a later version of Angular.

I found the following 2 articles:-
http://blog.angularjs.org/2013/08/angularjs-120-rc1-spooky-giraffe.html
http://blog.angularjs.org/2012/07/angularjs-10-12-roadmap.html

And i was wondering, if we should go with 1.2 RC2 - as it could be released by the time this module is public. We're currently not going to see any major updates to the 1.0.x, and at the same time, 1.1.x is only a development branch that keeps getting updated and is not safe to use

Points & Naming Schema Change

Hi Haidy,
With your good idea to use foreign keys for the database, I have also described a way to implement these on functions and table names. I should have thought of this earlier, although it was very good that you pointed this out.

Also with the addition of some functions (which we will add later) for managing comment_points, as well as post_points, we will have to build in this differentiation at the global level.

For updated info, including data for the naming schema and new tables, see this documentation :
https://www.evernote.com/shard/s275/sh/7fd5bb62-0902-4050-9889-338f847d044c/5fe6f3da3510557663e8693251ac8557

POINTS SCHEMA CHANGE

TABLE CHANGES
• 'wp_postworld_points' >> rename to >> 'wp_postworld_post_points'
• 'wp_postworld_meta' >> rename to >> 'wp_postworld_post_meta'
• create 'wp_postworld_comment_points' table
• create 'wp_postworld_comment_meta' table

COLUMN CHANGES
• in table 'wp_postworld_post_points' : column 'points' >> rename to >> 'post_points'
• in table 'wp_postworld_post_meta' : column 'points' >> rename to >> 'post_points'
• in table 'wp_postworld_user_meta' : ++ add 'post_points' column and 'comment_points' column

*FUNCTION NAME CHANGES *
• 'get_points()' >>>> >> rename to >> 'get_post_points()'
• 'calculate_points ()' >> rename to >> 'calculate_post_points ()'
• 'cache_points ()' >> rename to >> 'cache_post_points ()'
• 'set_points()' >> rename to >> 'set_post_points()'
• 'has_voted()' >> rename to >> 'has_voted_on_post()'
• 'get_user_points()' >> rename to >> 'get_user_points_voted_to_posts()'
• 'get_user_votes()' >> rename to >> 'get_user_votes_on_posts()'

Function Documentation now in GitHub

Hi Michel & Haidy,
To note, I have moved the documents from Evernote into GitHub and translated them into GitHub Flavored Markdown. There are some advantages and disadvantages to this :

  • Advantages
    • It's easier to access right in GitHub
    • Can see code syntax color coded
    • You will be able to update the file yourselves when there's changes or additions to functions
  • Disadvantages
    • No coloring or highlighting
    • We'll have to find another way to manage who is doing which functions, and the status of the functions
    • There is no proper support for tables, so the MySQL table structure will remain in Evernote
  • Starting now, you should be able to see all the function documentation right in-line in GitHub if you scroll to the bottom of each folder page.
  • To edit the documentation, just edit README.md and use GitHub Markdown
    https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet

Let me know if you have any questions.

Phong

pw_update_post() - Return Post ID, not Array

Hi Haidy,
I was working with implementing pw_update_post() and I noticed that we should make it just like the wp_update_post() method and return the post ID - not the post Array / Object.

Angular // feed_init Object - Set Defaults

Note to self -
Create default object for var feed_init = {}, and merge with feed_init['feed_id'] object which overrides settings, before setting it into feed_data Object, otherwise undefined settings will cause the controllers to malfunction.

Outdated Database Structure : User Meta

Hi Haidy,
I was looking through the DB structure, and I noticed we haven't implemented the new methods for storing favorites , view_later posts and viewed posts.

If you look in the updated User Meta table, and configuration in postworld_install.php you'll see we're still running on an old system.

Here is the new structure:
https://github.com/phongmedia/postworld/blob/master/dev/DATABASE-STRUCTURE.md#post_relationships--json

You can update all the install script, and corresponding methods : set_favorite(), add_favorite(), set_viewed(), etc.

These should all be using the get_post_relationship() and set_post_relationship() methods.

https://github.com/phongmedia/postworld/tree/master/php#get_post_relationship-relationship-post_id-user_id-

get_post_relationship()
https://github.com/phongmedia/postworld/tree/master/php#get_post_relationship-relationship-post_id-user_id-

set_post_relationship()
https://github.com/phongmedia/postworld/tree/master/php#set_post_relationship-relationship-post_id-user_id-switch-

Let me know if you have any questions about this.

Wordpress Ajax Design

wp_ajax functions are distinguished in wordpress as functions for logged in users and functions for anonymous users.

/* Action Hook for pw_live_feed() - Logged in users */
add_action("wp_ajax_pw_live_feed", "ajl_pw_live_feed");

/* Action Hook for pw_live_feed() - Anonymous users */
add_action("wp_ajax_nopriv_pw_live_feed", "ajn_pw_live_feed");

I assume that all ajax functions that we have documented so far can be accessed by any website visitor, is that assumption correct?
It is easy to change or update that in the future without much effort, but i wanted to confirm for the current design if that is the case.

get_user_votes() PHP Method - Function Renaming

Previously I had done a duplicate function name (by accident) and you intelligently renamed the second function to get_user_votes_by_post(). What I'd like to do is rename the functions/classes to fit an updated naming scheme. Here is the updated names.

get_user_votes() >> RENAME TO >> get_user_votes_report()
get_user_votes_by_post() >> RENAME TO >> get_user_votes()

o_embed() Implimentation Example

Hi Michel,
This is low priority -
I'm trying to use o_embed() JS function - I'm wondering how it can be used at the basic level. I tried this, although it's not working how I thought.

JAVASCRIPT

var embed = o_embed("http://www.youtube.com/watch?v=38peWm76l-U");
document.write(embed);

Set Query Defaults

Hi Haidy,
When doing queries, if certain parameter values aren't defined, we get errors :

Defaults:

'orderby' => 'date',
'offset' => 0,
'post_format' => null, // return any post format
'post_class' => null // return any post class

Wordpress Development Environment

Hi Haidy,
I noticed this line in postworld.php, which causes my development environment to crash :

//TO get user id from wordpress
require_once('/wp-config.php');
require_once('/wp-includes/wp-db.php');
require_once('/wp-includes/pluggable.php');

The best practice to use in this case is to create a page template 'sandbox' and attribute it to an empty page, where you can experiment within the Wordpress environment.

http://codex.wordpress.org/Page_Templates

You could copy another existing page template and just modify it with a new name, and then attribute it to an empty page.

How to:

  1. Duplicate /wp-content/theme/page.php as page-sandbox.php or whatever you want to call it.
  2. Add this to the top of the php file :
    <?php
    /

    Template Name: Sandbox
    /
  3. Create a new page in Wordpress. Under 'template' in the edit panel, set the dropdown to 'Sandbox'.
  4. Goto the page, ie. localhost:8888/sandbox

Now anything you do is in the WP environment. You can also add header and footer php tags to wrap it in your theme.

Did that work for you?

load-panel description

Phong,
while reviewing my tasks, i think i am a bit confused about load-panel directive.
The term panel to me was linked to the search widgets that contain different text fields, selects, checkboxes, etc.. to be used with filtering the feed.
And this is how i implemented the panel directive, to be a child of the live-feed directive. and i am sure this is something that is needed anyway.
Now re-reading the description, i think you might be referring to another functionality, and i am a bit confused on what it really does. Need your help here.

Live Feed & Query Routing Implimentation

Hi Michel,
Here is some details on an initial implementation of the 'live-feed' Angular directive, in the context of a real-time queryable search interface.

This is how the live-feed directive is activated.

feed_init['search_results'] = {
        preload : 10,
        load_increment : 10,
        view : {
            current : 'detail',
            options : ['list','detail','grid']
        },
        order_by : 'rank_score',
        panel : 'search_results',
        feed_query : 'url'
    };
<div live-feed="search_results"></div>

You will notice that the query_args field is a string 'url' instead of an object of actual query args. This will indicate that the query args are coming from the URL. Details can be seen in the latest documentation (see link below).

ie. realitysandwich.com/search/#/post-type=link&tax-topic=psyche&s=philosophy&orderby=rank_score

Taxonomy Query
The 'tax-topic' query var can be used to generate a tax_query field object for pw_query to match value to 'slug' within the custom taxonomy 'tax-{{taxonomy_name}}'. So this would also apply tax-category to the 'category' taxonomy, and tax-section to 'section' taxonomy, etc. Let me know if you have any questions about this, or Haidy should also know. See this for more info : http://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters

Basically :

array(
'taxonomy' => 'topic',
'field' => 'slug',
'terms' => 'psyche'
)

Work Plan
We can begin by implementing a prototype of the below 'design concept', which feeds query args into pw_query and returns the results real-time. When the feed is loading it can just have a simple 'loading' template which we can customize.

If you have any questions, don't hesitate to ask me. So far I've been impressed by the self-sustainability of the Innuva team, although if anything critical is unclear in the documentation, just let me know.

Thanks!

Wordpress Method:

I suggest making a Wordpress page template called 'Search Results' and set it on a new page called 'Search' with the permalink /search, and then invoking 'live-feed' in there.

Assets:

ngInfiniteScroll
http://binarymuse.github.io/ngInfiniteScroll/

Documentation:

POSTWORLD // Angular / JS Functions
https://github.com/phongmedia/postworld/tree/master/js

Design Concept:

live-feed-search

pw_query() PHP Method - Creation

Hi Haidy,
There is a custom query function called pw_query() which is in the documentation. This function is required for most of the feed functions to operate, so it is important to work on it soon.

Do you have any questions about how the function operates? If so, please ask me.

You can find here it under pw_query()
https://www.evernote.com/shard/s275/sh/7fd5bb62-0902-4050-9889-338f847d044c/5fe6f3da3510557663e8693251ac8557

We should prioritize this function over all other work this week until it's finished, so that the rest of the production can make use the function.

Thanks.

load-feed Implementation Errors

Hi Michel,

I'm trying to implement load-feed directive, and everything seems to be working quite well with the PHP so far in registering the feed, and the Angular is initializing the app correctly with all the JS files included, and following your examples of implimentation, although at initialization it gives this JS error.

pwData() Registering feed_settings 
[front_page_features: Object]
 angular.js:7861
pwData.pw_get_templates null angular.js:7861
pwData.wp_ajax pw_get_templates args:  Object {templates_object: null} angular.js:7861
pwApp RUN getTemplates= undefined app.js?ver=3.6.1:66
TypeError: Cannot read property 'posts' of undefined
    at getTemplate (http://localhost:8888/wp-content/plugins/postworld/js/services/pwData.js?ver=3.6.1:38:40)
    at Object.pw_get_template (http://localhost:8888/wp-content/plugins/postworld/js/services/pwData.js?ver=3.6.1:164:19)
    at http://localhost:8888/wp-content/plugins/postworld/js/components/liveFeed.js?ver=3.6.1:63:43
    at r (http://localhost:8888/wp-content/plugins/postworld/lib/angular/angular.min.js?ver=3.6.1:96:280)
    at http://localhost:8888/wp-content/plugins/postworld/lib/angular/angular.min.js?ver=3.6.1:97:417
    at h.$eval (http://localhost:8888/wp-content/plugins/postworld/lib/angular/angular.min.js?ver=3.6.1:105:313)
    at h.$digest (http://localhost:8888/wp-content/plugins/postworld/lib/angular/angular.min.js?ver=3.6.1:103:190)
    at h.$apply (http://localhost:8888/wp-content/plugins/postworld/lib/angular/angular.min.js?ver=3.6.1:106:100)
    at k (http://localhost:8888/wp-content/plugins/postworld/lib/angular/angular.min.js?ver=3.6.1:63:281)
    at x (http://localhost:8888/wp-content/plugins/postworld/lib/angular/angular.min.js?ver=3.6.1:67:171) 

Is there something that I'm not doing here to make it work?
This is the implementation here:

PHP : (working fine)

$args = array (
        'feed_id' => 'front_page_features',
        'write_cache'  => false,
        'feed_query' => array(
            'post_count' => 200,
            'fields' => 'all',
            'post_type' => 'post',
            'orderby' => 'date',
            'offset' => 3,
            'post_format' => null,
            'post_class' => null,
            'posts_per_page' => 200
        )
    );
    pw_register_feed ($args);

Javascript: (throwing an error)

feed_settings['front_page_features'] = {
            preload : 10,
            load_increment : 5,
            offset: 0,
            max_posts:200,
            view : {
                current : 'detail',
                options : ['list','detail']
            },
        };

HTML:

<div load-feed="front_page_features" ></div>

Let me know what might be wrong here, as it's currently holding back implementation.

set_post_relationship() - Update

Hi Haidy,
I added a line in the documentation for:

set_post_relationship()
https://github.com/phongmedia/postworld/tree/master/php#set_post_relationship-relationship-post_id-user_id-switch-

Under Favorites :

  • If $relationship == favorite : Add / remove a row to Favorites table

So here we will be able to make use of the Favorites table. There is no usage of the favorites table yet, it is un-used, although this will allow us to collect data which will allow recommendations based on favorites.

Up to this point we had a Favorites table which was previously un-used:
https://github.com/phongmedia/postworld/blob/master/dev/DATABASE-STRUCTURE.md#favorites

pw_get_templates() - Path Options

Hi Haidy,
I was just working with pw_get_templates(), and it doesn't seem to be scanning the over-ride paths for files, always returning only what is in the plugins path.

I had success by changing the paths in postworld_options.php from double backslash to forward slash and that made it work.

OLD

'default_posts_template_abs_path' => ABSPATH . "wp-content/plugins/postworld/templates/posts/" ,
        'override_posts_template_abs_path' => get_template_directory()."\\postworld\\templates\\posts\\",
        'default_panel_template_abs_path' => ABSPATH . "wp-content/plugins/postworld/templates/panels/" ,
        'override_panel_template_abs_path' => get_template_directory()."\\postworld\\templates\\panels\\",

NEW

'default_posts_template_abs_path' => ABSPATH . "wp-content/plugins/postworld/templates/posts/" ,
        'override_posts_template_abs_path' => get_template_directory()."/postworld/templates/posts/",
        'default_panel_template_abs_path' => ABSPATH . "wp-content/plugins/postworld/templates/panels/" ,
        'override_panel_template_abs_path' => get_template_directory()."/postworld/templates/panels/",

Are there any foreseeable issues that may be caused by this change?

load-comments Directive

Hi Michel,
I have added a directive called load-comments which basically does what the name says. It loads comments. Here is the documentation for that.

load-comments [ directive ]
https://github.com/phongmedia/postworld/tree/master/js#load-comments--directive-

Two things I have done to get the process going:

  1. The main depednency function is complete:
    pw_get_comments() : https://github.com/phongmedia/postworld/tree/master/php#pw_get_comments--query-fields-tree-
  2. I have put in some template structure in these files:
    • templates/comments/comments-header.html
    • templates/comments/comment-single.html

Mind you, whatever is in the templates is very rough right now, and it is structurally incomplete, although it's a starting point which you can work from - please feel free to re-arrange the templates in any way you see fit.

The comments are meant to work in the same way as the comments on Reddit.

Let me know if you have any questions, and we can talk on Skype this week if you like to clarify any issues.

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.