Jump to content

breezer

Members
  • Posts

    29
  • Joined

  • Last visited

Posts posted by breezer

  1. Hello folks, I was working on a forum module which is about 65% done and was wondering if there would be enough interest to continue development. This would be a paid module of course due to the amount of time involved.

    I should have my workspace set back up in a few weeks, but later today I'll get a feature list and some screenshots of what I have so far and add them to this thread. Thanks for your time ?

    • Like 5
  2. I use the following method with success, in your module:

        public function init() {
    		// add a hook after each page is rendered and modify the output
    		$this->addHookAfter('Page::render', $this, 'page_after_render');
        }
    
        public function page_after_render($event) {	
    		/** @var Page $page */
    		$page = $event->object; 
            if( $page->template =='admin' ){
    			$head_include ='<link rel="stylesheet" type="text/css" href="PATH/TO/YOUR/CSS" />
    			';
    			$replace = array(
    				'</head>'    =>  $head_include .'</head>'
    			);	
    		    $event->return = str_replace( array_keys( $replace ), array_values( $replace ), $event->return );
            }
        }

    Pretty simple and $replace array can be extended as needed.

    • Like 2
  3. Hello all, just an quick update on progress and a question or two. Although rewrite is going slow, I'm pretty happy with the results so far.

    The forum admin is working in front end and back end (both areas use the same file but with different tpls and stylesheet).

    User account on front end is working, I made it so new features can be easily added when needed.

    Front end forum is working, still have to finish the create and edit post functionality and straighten up alot of inline styles in the tpls. I decided to use the built in ckeditor for creation/editing and integrated roxy fileman to insert/manage attachments.

    frontend_1.jpg.91acd118c0c939893478ea6b11cafc3f.jpg

    backend_1.jpg.a684d46b8bf621c3f9c0c2ca34a9fc08.jpg

    account_1.jpg.2a06be5dfeeeec07e87cbfbf1b92ffda.jpg

    account_2.jpg.fa18b7ecc5e35e1497f5dc95337aa7ea.jpg

    forum_1.jpg.ad30c24e957c30b2f81ef38f3421bb07.jpg

    forum_2.jpg.fb7b43b59966b8baeb9f4527982e9774.jpg

    Still a ways to go but I'm plugging along so hopefully there will be a test version out within the next couple weeks ?

    • Like 5
  4. EDIT: This has nothing to do with Tracy, I'm getting the same message with PW debug enabled so the issue is elsewhere. Thanks for your time.

    Is this a new issue for you in 4.16.8?

    To be honest I'm not sure, I didn't have it turned on lately and I upgraded this morning and noticed the message.

    Do you have any serialize() calls in your code anywhere?

    No I can't think of any but I'm going through all the files to check.

    Could you check in the Tracy logs directory:

    No files at all in the Tracy log directory.

    I also made the getExceptionFile()  method only return true ( in module file and also checked filecompiler ) and still the message shows, so please don't waste any time on this as I have to assume it's something in my code somewhere. I'll look in all the files and see if I can figure it out.

    Again Happy New Year and thanks for a super tool ?

    • Like 1
  5. Hello all, hope everyone has a happy new year ?

    I'm using the newest version of Tracy ( 4.16.8 ) and after enabling Tracy this is showing at the bottom of all pages, front and back end:

    Fatal error: Uncaught Exception: Serialization of 'Closure' is not allowed in [no active file] on line 0

    Googling the message tells me this is something to do with unit testing? Is this Tracy or something in my code?

    PW: 30118

    Apache Version: 2.4.23  - Documentation

    PHP Version: 7.0.10  - Documentation

    Server Software: Apache/2.4.23 (Win64) PHP/7.0.10 - Port defined for Apache: 80

  6. Hello all, hope everyone's holiday season has been delightful ?

    Is there a way to allow a specific .php file to be accessed from site/modules ( which is protected via htaccess )?

    I have an ajax file manager which integrates into a ckeditor front end instance which works fine as a .html file, but if accessed through url or in the ckeditor and user has no permission it still shows the user interface ( although all buttons are disabled ). If I rename it to .php I can kill the process and output an informational message.

    As a .php file the following directive in htaccess forbids it due to it residing in my module folder.

    # Block access to any PHP files in /site/modules/
      RewriteCond %{REQUEST_URI} (^|/)(site|site-[^/]+)/modules/.*\.(php|inc|tpl|module|info\.json)$ [OR]

    This is the current url:

    /pwire30118/site/modules/Xforum/assets/fileman/dev.html

    This preferred:

    /pwire30118/site/modules/Xforum/assets/fileman/dev.php

    If anyone can help it is greatly appreciated, my eyes are bleeding from reading htaccess articles...
     

  7. This is the way I found that works:

    1. Create a new folder in your site Modules folder named Injector ( site/modules/Injector ).

    2. Copy / paste the following code into a file named Injector.module.php and put it in your module folder.

    <?php namespace ProcessWire;
    class Injector extends Process {
      
      public static function getModuleinfo() {
        return [	  
          'title' => 'Injector',	  
          'summary' => 'Add content before </head> and before </body>',	  
          'href' => '',	  
          'author' => '',	  
          'version' => '1.0.0',	   
    	  'singular' => true, 
    	  'autoload' => true, 
        ];
      }
      
    	public function init() {
    		// add a hook after each page is rendered and modify the output
    		$this->addHookAfter('Page::render', $this, 'after_render');		
    	}
    	
        public function after_render($event) {	
    		/** @var Page $page */
    		$page = $event->object; 
    
    		// ignore templates
    		$ignore = array( 'admin' );
    		if( !in_array( $page->template, $ignore ) ){
    			$replace =array(
    				'<!--[+head.include+]-->'  => ( defined( 'HEAD_INCLUDE' ) ? HEAD_INCLUDE : '' ),
    				'<!--[+body.include+]-->'  => ( defined( 'BODY_INCLUDE' ) ? BODY_INCLUDE : '' )
    				);
    		
    			$event->return = str_replace( array_keys( $replace ), array_values( $replace ),$event->return );
    			
    	    }
    	}
    }

    4. In your admin, refresh Modules and then install Injector.

    5. In your template before the </head> tag, add <!--[+head.include+]-->, also optional add the <!--[+body.include+]--> before the </body> tag.

    6. In your script(s) define HEAD_INCLUDE and BODY_INCLUDE ( optional ), ex:
     

    $head_include ='<link rel="canonical" href="http://example.com/tags/" />';
    
    define( 'HEAD_INCLUDE', $head_include );

    Do the same thing for BODY_INCLUDE if needed.

    Hope this helps.

    • Like 1
  8. I had some trouble with FileCompiler when I first started, which pretty much match your issues. Perhaps that is something to look into if this isn't yet solved. Go to the main Processwire site and search in the blog posts for more information on FileCompiler.

    You can also try going to Admin/Modules, then at the very bottom of the modules list there is a button "Clear Compiled Files"

  9. Quote

    Personally I recommend the following config option: Modules > Core > AdminThemeUikit > Layout + interface > Inputfield column widths > Percentage-based widths

    Yes that feature is enabled. Here is what I get from the following setup:

    fieldwidth_1.jpg.af9c2b0cf628e411f323d0986bbd455c.jpg

    fieldwidth_2.jpg.8ccb0db40a69842614a77a51563f9a05.jpg

    fieldwidth_3.jpg.fdab8c9daa6797470591c21182be4cf5.jpg

    fieldwidth_4.jpg.1381ccfb049bc4e08bb04df2c9a7e92e.jpg

     

  10. My setup is non modified PW dev and uikit admin theme. I basically just edited the existing user template, and moved the role tab last in the sort since it doesn't show during profile edit. Then go to edit my profile to check the fields. All the items are pushed far left and there is a space on the right of the column:

    | [ Field One ] [Field Two]     |

    | [ Field One ] [ Field Two ] [ Field Three ]     |

    What am I looking for when I use the dev tools, css issues are pretty much out of my realm lol

     

  11. Thanks for this helper module, it works great. The only issue I see in my case is that the total percentage width of the rows only equals:

    2 items per row - 92%.

    3 items per row - 86%

    Any more than that and the field falls back down. Other than that its awesome, many thanks.

    Running v0.1.5 , Processwire 3.0.1.1.8, Firefox browser, wamp on windows 7

  12. I'm new to PW and just learning hooks myself but this is how I got the loginSuccess hook to work in site/_init.php.

    Note this only sets a session variable but it is proof that the hook is there and working.

    wire()->addHook('LoginRegister::loginSuccess', function($event) { // outside a class
        $session = wire('session');
        $session->set('Login_Register_hook', 'success');
    });

    output:
      [Login_Register_hook] => success

    wire()->addHook('LoginRegister::loginFail', function($event) {
        $session = wire('session');
        $session->set('Login_Register_hook', 'failure');
    });

    output:

    [Login_Register_hook] => failure

    • Like 1
  13. This is what the final working template file looks like:
     

    <?php  namespace ProcessWire;
    
    /*FileCompiler=0*/
    
    defined( 'XFORUM_MODE' ) or die( '<b>UNAUTHORIZED_ACCESS_ERROR</b>' );
    
    // check for valid_key and compare to users id
    if( wire('input')->get->text('valid_key') == wire('session')->user('id') ){
    	echo xforum_process_page( $pname='ajax', $return='echo', $options, $xarray = $xforum);
    }else{
    	echo "error";
    }
    // Call halt() to prevent further loading
    $this->halt();

     

×
×
  • Create New...